Module: VectorSpace::Family::ClassMethods
- Defined in:
- lib/vector_space/family.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
Instance Method Summary collapse
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
12 13 14 |
# File 'lib/vector_space/family.rb', line 12 def index @index end |
Instance Method Details
#components ⇒ Object
19 20 21 |
# File 'lib/vector_space/family.rb', line 19 def components [index] + super end |
#indexed_by(index, options = {}) ⇒ Object
14 15 16 17 |
# File 'lib/vector_space/family.rb', line 14 def indexed_by(index, = {}) @index = index (@component_reflections ||= {})[index] = IndexReflection.new(index, ) end |
#zero(attributes = {}) ⇒ Object
23 24 25 |
# File 'lib/vector_space/family.rb', line 23 def zero(attributes = {}) new Hash[[[index, attributes[index] || reflect_on_component(index).default]] + dimensions.map { |dimension| [dimension, reflect_on_component(dimension).zero] }] end |