Class: FinerStruct::Immutable
- Inherits:
-
Object
- Object
- FinerStruct::Immutable
- Defined in:
- lib/finer_struct/immutable.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Immutable
constructor
A new instance of Immutable.
- #method_missing(method, *arguments) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Immutable
Returns a new instance of Immutable.
4 5 6 |
# File 'lib/finer_struct/immutable.rb', line 4 def initialize(attributes = {}) @attributes = attributes.dup end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/finer_struct/immutable.rb', line 8 def method_missing(method, *arguments) if @attributes.has_key?(method) @attributes[method] else super end end |