Module: Eve::API::Response::WrapObject

Included in:
Eve::API::Response, Rowset
Defined in:
lib/eve/api/response/wrap_object.rb

Instance Method Summary collapse

Instance Method Details

#wrap_object(method_name, value) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/eve/api/response/wrap_object.rb', line 5

def wrap_object(method_name, value)
  klass = (class << self; self; end)
  underscored = method_name.to_s.underscore
  klass.send(:attr_reader, underscored)
  klass.send(:delegate, method_name, :to => underscored) unless method_name == underscored
  instance_variable_set("@#{underscored}", value)
end