Class: RFunk::Immutable
- Inherits:
-
Object
- Object
- RFunk::Immutable
- Defined in:
- lib/rfunk/attribute/immutable.rb
Instance Method Summary collapse
Instance Method Details
#create(options) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/rfunk/attribute/immutable.rb', line 3 def create() instance = .fetch(:instance) variable_name = .fetch(:variable_name) value = .fetch(:value) instance.class.new.tap do |object| create_instance_variables(instance, object, variable_name) object.instance_variable_set(variable_name, value) object.deep_freeze if should_deep_freeze?(value) end end |