class RestCore::Clash

Constants

Empty

Attributes

data[RW]

Public Class Methods

new(data) click to toggle source
# File lib/rest-core/util/clash.rb, line 7
def initialize data
  self.data = data
end

Public Instance Methods

==(rhs) click to toggle source
# File lib/rest-core/util/clash.rb, line 19
def == rhs
  if rhs.kind_of?(Clash)
    data == rhs.data
  else
    data == rhs
  end
end
[](k) click to toggle source
# File lib/rest-core/util/clash.rb, line 11
def [] k
  if data.key?(k)
    convert(data[k])
  else
    Empty
  end
end

Private Instance Methods

convert(value) click to toggle source
# File lib/rest-core/util/clash.rb, line 28
def convert value
  case value
  when Hash
    Clash.new(value)
  when Array
    value.map{ |ele| convert(ele) }
  else
    value
  end
end
method_missing(msg, *args, &block) click to toggle source
Calls superclass method
# File lib/rest-core/util/clash.rb, line 43
def method_missing msg, *args, &block
  if data.respond_to?(msg)
    data.public_send(msg, *args, &block)
  else
    super
  end
end
respond_to_missing?(msg, include_private=false) click to toggle source
# File lib/rest-core/util/clash.rb, line 39
def respond_to_missing? msg, include_private=false
  data.respond_to?(msg, include_private)
end