Class: Unity::SimpleUnit

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, Dimension::Integer
Defined in:
lib/unity/lookup/simple_unit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Dimension::Integer

#dimension_int, #property, #property_name

Constructor Details

#initialize(attributes = {}) ⇒ SimpleUnit

Returns a new instance of SimpleUnit.



19
20
21
22
23
# File 'lib/unity/lookup/simple_unit.rb', line 19

def initialize(attributes = {})
  attributes.each do |name, value|
    send("#{name}=", value)
  end
end

Instance Attribute Details

#dimensionObject

Returns the value of attribute dimension.



8
9
10
# File 'lib/unity/lookup/simple_unit.rb', line 8

def dimension
  @dimension
end

#nameObject Also known as: to_s

Returns the value of attribute name.



8
9
10
# File 'lib/unity/lookup/simple_unit.rb', line 8

def name
  @name
end

#si_factorObject

Returns the value of attribute si_factor.



8
9
10
# File 'lib/unity/lookup/simple_unit.rb', line 8

def si_factor
  @si_factor
end

Instance Method Details

#dimension_vectorObject



15
16
17
# File 'lib/unity/lookup/simple_unit.rb', line 15

def dimension_vector
  @dimension_vector ||= Dimension::LIST.map{|d| d == dimension ? 1 : 0 }
end