Class: TPPlus::Nodes::SpeedNode
- Inherits:
-
Object
- Object
- TPPlus::Nodes::SpeedNode
- Defined in:
- lib/tp_plus/nodes/speed_node.rb
Instance Method Summary collapse
- #eval(context) ⇒ Object
-
#initialize(speed_hash) ⇒ SpeedNode
constructor
A new instance of SpeedNode.
- #speed(context) ⇒ Object
- #units ⇒ Object
Constructor Details
#initialize(speed_hash) ⇒ SpeedNode
Returns a new instance of SpeedNode.
4 5 6 |
# File 'lib/tp_plus/nodes/speed_node.rb', line 4 def initialize(speed_hash) @speed_hash = speed_hash end |
Instance Method Details
#eval(context) ⇒ Object
22 23 24 25 26 |
# File 'lib/tp_plus/nodes/speed_node.rb', line 22 def eval(context) return @speed_hash[:speed] if @speed_hash[:units].nil? "#{speed(context)}#{units}" end |
#speed(context) ⇒ Object
8 9 10 |
# File 'lib/tp_plus/nodes/speed_node.rb', line 8 def speed(context) @speed_hash[:speed].eval(context) end |
#units ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/tp_plus/nodes/speed_node.rb', line 12 def units case @speed_hash[:units] when "mm/s" "mm/sec" else @speed_hash[:units] end end |