Class: Dillo::Record
- Inherits:
-
Object
- Object
- Dillo::Record
- Defined in:
- lib/dillo.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.
172 173 174 |
# File 'lib/dillo.rb', line 172 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
184 185 186 187 188 189 190 |
# File 'lib/dillo.rb', line 184 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.
170 171 172 |
# File 'lib/dillo.rb', line 170 def attributes @attributes end |
Instance Method Details
#inspect ⇒ Object
192 193 194 |
# File 'lib/dillo.rb', line 192 def inspect "#<#{self.class.name}:#{id}>" end |
#respond_to?(method) ⇒ Boolean
180 181 182 |
# File 'lib/dillo.rb', line 180 def respond_to?(method) @attributes.has_key?(method.to_s) || super end |