Class: Unitwise::Standard::Function
- Inherits:
-
Object
- Object
- Unitwise::Standard::Function
- Defined in:
- lib/unitwise/standard/function.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Function
constructor
A new instance of Function.
- #name ⇒ Object
- #primary ⇒ Object
- #secondary ⇒ Object
- #to_hash ⇒ Object
- #unit ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Function
Returns a new instance of Function.
6 7 8 |
# File 'lib/unitwise/standard/function.rb', line 6 def initialize(attributes) @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/unitwise/standard/function.rb', line 4 def attributes @attributes end |
Instance Method Details
#name ⇒ Object
10 11 12 |
# File 'lib/unitwise/standard/function.rb', line 10 def name attributes["function"]["@name"] end |
#primary ⇒ Object
22 23 24 |
# File 'lib/unitwise/standard/function.rb', line 22 def primary attributes["@Unit"].gsub(/\(.*\)/, '') end |
#secondary ⇒ Object
26 27 28 |
# File 'lib/unitwise/standard/function.rb', line 26 def secondary attributes["@UNIT"] end |
#to_hash ⇒ Object
30 31 32 |
# File 'lib/unitwise/standard/function.rb', line 30 def to_hash {:function_code => primary, :value => value, :unit_code => unit} end |
#unit ⇒ Object
18 19 20 |
# File 'lib/unitwise/standard/function.rb', line 18 def unit attributes["function"]["@Unit"] end |