Class: FinerStruct::Immutable
- Inherits:
-
Object
- Object
- FinerStruct::Immutable
- Defined in:
- lib/finer_struct/immutable.rb
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.
6 7 8 9 |
# File 'lib/finer_struct/immutable.rb', line 6 def initialize(attributes = {}) @attributes = attributes.dup.freeze freeze end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/finer_struct/immutable.rb', line 11 def method_missing(method, *arguments) if @attributes.has_key?(method) @attributes[method] else super end end |