Class: RubyAPI::BodyProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/fastrb/context.rb

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ BodyProxy

Returns a new instance of BodyProxy.



139
140
141
# File 'lib/fastrb/context.rb', line 139

def initialize(data)
  @data = data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



151
152
153
154
155
156
157
# File 'lib/fastrb/context.rb', line 151

def method_missing(name, *args)
  if @data.key?(name.to_s)
    @data[name.to_s]
  else
    super
  end
end

Instance Method Details

#[](key) ⇒ Object



143
144
145
# File 'lib/fastrb/context.rb', line 143

def [](key)
  @data[key.to_s]
end

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:



159
160
161
# File 'lib/fastrb/context.rb', line 159

def respond_to_missing?(name, include_private = false)
  @data.key?(name.to_s) || super
end

#to_hObject



147
148
149
# File 'lib/fastrb/context.rb', line 147

def to_h
  @data
end