Class: KansujiToNumber::Layer2ExpressionNode
- Inherits:
-
Struct
- Object
- Struct
- KansujiToNumber::Layer2ExpressionNode
- Defined in:
- lib/kansuji_to_number/kansuji_nodes.rb
Instance Attribute Summary collapse
-
#left ⇒ Object
Returns the value of attribute left.
-
#right ⇒ Object
Returns the value of attribute right.
-
#unit ⇒ Object
Returns the value of attribute unit.
Instance Method Summary collapse
Instance Attribute Details
#left ⇒ Object
Returns the value of attribute left
22 23 24 |
# File 'lib/kansuji_to_number/kansuji_nodes.rb', line 22 def left @left end |
#right ⇒ Object
Returns the value of attribute right
22 23 24 |
# File 'lib/kansuji_to_number/kansuji_nodes.rb', line 22 def right @right end |
#unit ⇒ Object
Returns the value of attribute unit
22 23 24 |
# File 'lib/kansuji_to_number/kansuji_nodes.rb', line 22 def unit @unit end |
Instance Method Details
#eval ⇒ Object
23 24 25 26 27 |
# File 'lib/kansuji_to_number/kansuji_nodes.rb', line 23 def eval l = left ? left.eval : 1 r = right ? right.eval : 0 l * unit + r end |