Class: Unitwise::Standard::Scale
- Inherits:
-
Object
- Object
- Unitwise::Standard::Scale
- Defined in:
- lib/unitwise/standard/scale.rb
Instance Attribute Summary collapse
-
#nori ⇒ Object
Returns the value of attribute nori.
Instance Method Summary collapse
-
#initialize(nori) ⇒ Scale
constructor
A new instance of Scale.
- #primary_unit_code ⇒ Object
- #secondary_unit_code ⇒ Object
- #to_hash ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(nori) ⇒ Scale
Returns a new instance of Scale.
5 6 7 |
# File 'lib/unitwise/standard/scale.rb', line 5 def initialize(nori) @nori = nori end |
Instance Attribute Details
#nori ⇒ Object
Returns the value of attribute nori.
3 4 5 |
# File 'lib/unitwise/standard/scale.rb', line 3 def nori @nori end |
Instance Method Details
#primary_unit_code ⇒ Object
13 14 15 |
# File 'lib/unitwise/standard/scale.rb', line 13 def primary_unit_code nori.attributes["Unit"] end |
#secondary_unit_code ⇒ Object
17 18 19 |
# File 'lib/unitwise/standard/scale.rb', line 17 def secondary_unit_code nori.attributes["UNIT"] end |
#to_hash ⇒ Object
21 22 23 |
# File 'lib/unitwise/standard/scale.rb', line 21 def to_hash {:value => value, :unit_code => primary_unit_code} end |
#value ⇒ Object
9 10 11 |
# File 'lib/unitwise/standard/scale.rb', line 9 def value Unitwise::Number.coefficify(nori.attributes.fetch('value')) end |