Class: FinerStruct::Mutable

Inherits:
Immutable show all
Defined in:
lib/finer_struct/mutable.rb

Instance Method Summary collapse

Methods inherited from Immutable

#initialize

Constructor Details

This class inherits a constructor from FinerStruct::Immutable

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/finer_struct/mutable.rb', line 7

def method_missing(method, *arguments)
  if is_assigment?(method) && @attributes.has_key?(key_for_assignment(method))
    @attributes[key_for_assignment(method)] = arguments[0]
  else
    super
  end
end