Class: Windy::Record
- Inherits:
-
Object
- Object
- Windy::Record
- Defined in:
- lib/windy.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Record
constructor
A new instance of Record.
- #inspect ⇒ Object
- #method_missing(method, *args, &block) ⇒ Object
- #respond_to?(method) ⇒ Boolean
Constructor Details
#initialize(attributes) ⇒ Record
Returns a new instance of Record.
171 172 173 |
# File 'lib/windy.rb', line 171 def initialize(attributes) self.attributes = attributes end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
183 184 185 186 187 188 189 |
# File 'lib/windy.rb', line 183 def method_missing(method, *args, &block) if respond_to?(method) @attributes[method.to_s] else super end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
169 170 171 |
# File 'lib/windy.rb', line 169 def attributes @attributes end |
Instance Method Details
#inspect ⇒ Object
191 192 193 |
# File 'lib/windy.rb', line 191 def inspect "#<#{self.class.name}:#{id}>" end |
#respond_to?(method) ⇒ Boolean
179 180 181 |
# File 'lib/windy.rb', line 179 def respond_to?(method) @attributes.has_key?(method.to_s) || super end |