Class: KansujiToNumber::Layer1ExpressionNode
- Inherits:
-
Struct
- Object
- Struct
- KansujiToNumber::Layer1ExpressionNode
- 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
14 15 16 |
# File 'lib/kansuji_to_number/kansuji_nodes.rb', line 14 def left @left end |
#right ⇒ Object
Returns the value of attribute right
14 15 16 |
# File 'lib/kansuji_to_number/kansuji_nodes.rb', line 14 def right @right end |
#unit ⇒ Object
Returns the value of attribute unit
14 15 16 |
# File 'lib/kansuji_to_number/kansuji_nodes.rb', line 14 def unit @unit end |
Instance Method Details
#eval ⇒ Object
15 16 17 18 19 |
# File 'lib/kansuji_to_number/kansuji_nodes.rb', line 15 def eval l = left ? left.eval : 1 r = right ? right.eval : 0 l * unit + r end |