Module: NRSER::Props::Mutable::InstanceVariables
- Defined in:
- lib/nrser/props/mutable/instance_variables.rb
Overview
Mix-in to store property values in instance variables of the same name.
Constant Summary collapse
- STORAGE =
NRSER::Props::Storage::InstanceVariables.new immutable: false
Class Method Summary collapse
-
.included(base) ⇒ Object
Class Methods ======================================================================.
Instance Method Summary collapse
-
#initialize_props(values = {}) ⇒ Object
Since the Immutable::InstanceVariables mix-in does not need to tap into the initialize chain,.
Class Method Details
Instance Method Details
#initialize_props(values = {}) ⇒ Object
Since the Immutable::InstanceVariables mix-in does not need to tap into the initialize chain,
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/nrser/props/mutable/instance_variables.rb', line 49 def initialize_props values = {} self.class..each_primary_prop_value_from( values ) { |prop, value| instance_variable_set "@#{ prop.name }", value } # Check additional type invariants self.class.invariants.each do |type| type.check self end end |