Class: ExpressPigeon::MetaResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/expresspigeon-ruby/meta_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(delegate) ⇒ MetaResponse

Returns a new instance of MetaResponse.



4
5
6
7
8
9
10
11
12
# File 'lib/expresspigeon-ruby/meta_response.rb', line 4

def initialize(delegate)
  @delegate = delegate
  @delegate.each_key do |k|
    v = @delegate[k] # lets go only one level down for now
    if v.kind_of? Hash
      @delegate[k] = MetaResponse.new(v)
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



14
15
16
# File 'lib/expresspigeon-ruby/meta_response.rb', line 14

def method_missing(m, *args, &block)
  @delegate[m.to_s]
end

Instance Method Details

#inspectObject



26
27
28
# File 'lib/expresspigeon-ruby/meta_response.rb', line 26

def inspect
  @delegate.inspect
end

#respond_to?(m, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/expresspigeon-ruby/meta_response.rb', line 18

def respond_to?(m,  include_all = false)
  @delegate.key?(m.to_s)
end

#to_sObject



22
23
24
# File 'lib/expresspigeon-ruby/meta_response.rb', line 22

def to_s
  @delegate.to_s
end