Module: NRSER::Props::Immutable::InstanceVariables
- Defined in:
- lib/nrser/props/immutable/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: true
Class Method Summary collapse
-
.included(base) ⇒ Object
Class Methods ======================================================================.
Instance Method Summary collapse
-
#initialize_props(values = {}) ⇒ Object
Since the InstanceVariables mix-in does not need to tap into the initialize chain,.
Class Method Details
Instance Method Details
#initialize_props(values = {}) ⇒ Object
Since the NRSER::Props::Immutable::InstanceVariables mix-in does not need to tap into the initialize chain,
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/nrser/props/immutable/instance_variables.rb', line 37 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 |