class RestCore::Smash

Attributes

data[RW]

Public Class Methods

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

Public Instance Methods

==(rhs) click to toggle source
# File lib/rest-core/util/smash.rb, line 21
def == rhs
  if rhs.kind_of?(RestCore::Smash)
    data == rhs.data
  else
    data == rhs
  end
end
[](*keys) click to toggle source
# File lib/rest-core/util/smash.rb, line 9
def [] *keys
  keys.inject(data) do |r, k|
    if r.respond_to?(:key) && r.key?(k)
      r[k]
    elsif r.respond_to?(:[])
      r[k]
    else
      return nil # stop here
    end
  end
end

Private Instance Methods

method_missing(msg, *args, &block) click to toggle source
Calls superclass method
# File lib/rest-core/util/smash.rb, line 34
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/smash.rb, line 30
def respond_to_missing? msg, include_private=false
  data.respond_to?(msg, include_private)
end