Class: Schron::GenericEntity
- Inherits:
-
Object
- Object
- Schron::GenericEntity
- Defined in:
- lib/schron/generic_entity.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ GenericEntity
constructor
A new instance of GenericEntity.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ GenericEntity
Returns a new instance of GenericEntity.
6 7 8 |
# File 'lib/schron/generic_entity.rb', line 6 def initialize(attrs={}) @attributes = attrs end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/schron/generic_entity.rb', line 10 def method_missing(method, *args) if args.empty? && @attributes.key?(method) @attributes[method] else super end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/schron/generic_entity.rb', line 4 def attributes @attributes end |