Class: EEML::Unit
- Inherits:
-
Object
- Object
- EEML::Unit
- Defined in:
- lib/eeml/unit.rb
Overview
An class representing a unit or measurement. Can be added to EEML::Data objects
Instance Attribute Summary collapse
-
#name ⇒ Object
Name of the unit (e.g. “metre”).
-
#symbol ⇒ Object
Symbol for the unit (e.g. “m”).
Instance Method Summary collapse
-
#initialize(unit_name, options = {}) ⇒ Unit
constructor
Create a new EEML::Unit item.
-
#type ⇒ Object
Get the type of the unit.
-
#type=(unit_type) ⇒ Object
Set the type of the unit - must be one of :basicSI, :derivedSI, :conversionBasedUnits, :derivedUnits or :contextDependentUnits.
Constructor Details
#initialize(unit_name, options = {}) ⇒ Unit
Create a new EEML::Unit item.
8 9 10 11 12 |
# File 'lib/eeml/unit.rb', line 8 def initialize(unit_name, = {}) @name = unit_name @symbol = [:symbol] set_type([:type]) end |
Instance Attribute Details
#name ⇒ Object
Name of the unit (e.g. “metre”)
15 16 17 |
# File 'lib/eeml/unit.rb', line 15 def name @name end |
#symbol ⇒ Object
Symbol for the unit (e.g. “m”)
18 19 20 |
# File 'lib/eeml/unit.rb', line 18 def symbol @symbol end |
Instance Method Details
#type ⇒ Object
Get the type of the unit
21 22 23 |
# File 'lib/eeml/unit.rb', line 21 def type @type end |
#type=(unit_type) ⇒ Object
Set the type of the unit - must be one of :basicSI, :derivedSI, :conversionBasedUnits, :derivedUnits or :contextDependentUnits
26 27 28 |
# File 'lib/eeml/unit.rb', line 26 def type=(unit_type) set_type(unit_type) end |