Module: NRSER::Props::Immutable::Vector::ClassMethods
- Defined in:
- lib/nrser/props/immutable/vector.rb
Overview
Methods mixed in at the class-level.
Instance Method Summary collapse
-
#alloc(*args) ⇒ Hamster::Vector
Hamster::Vector uses
.allocto quickly create derived instances when it knows the instance variables.
Instance Method Details
#alloc(*args) ⇒ Hamster::Vector
Hamster::Vector uses .alloc to quickly create derived instances when it knows the instance variables. We need to hook into that to check the prop types.
74 75 76 77 78 79 80 |
# File 'lib/nrser/props/immutable/vector.rb', line 74 def alloc *args super( *args ).tap do |new_instance| self.props( only_primary: true ).each_value do |prop| prop.check! new_instance[prop.index] end end end |