Class: RestEasy::Resource::ModelProxy
- Inherits:
-
Object
- Object
- RestEasy::Resource::ModelProxy
- Defined in:
- lib/rest_easy/resource.rb
Overview
── Simple wrappers for instance state ──────────────────────────────
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(attributes) ⇒ ModelProxy
constructor
A new instance of ModelProxy.
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(attributes) ⇒ ModelProxy
Returns a new instance of ModelProxy.
78 79 80 81 82 83 |
# File 'lib/rest_easy/resource.rb', line 78 def initialize(attributes) @attributes = attributes attributes.each_key do |attr_name| define_singleton_method(attr_name) { @attributes[attr_name] } end end |
Instance Method Details
#attributes ⇒ Object
85 86 87 |
# File 'lib/rest_easy/resource.rb', line 85 def attributes @attributes end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
89 90 91 |
# File 'lib/rest_easy/resource.rb', line 89 def respond_to_missing?(method_name, include_private = false) @attributes.key?(method_name.to_sym) || super end |