Class: TPPlus::Nodes::DigitNode
- Inherits:
-
Object
- Object
- TPPlus::Nodes::DigitNode
- Defined in:
- lib/tp_plus/nodes/digit_node.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #eval(context, options = {}) ⇒ Object
-
#initialize(value) ⇒ DigitNode
constructor
A new instance of DigitNode.
- #requires_mixed_logic?(context) ⇒ Boolean
Constructor Details
#initialize(value) ⇒ DigitNode
Returns a new instance of DigitNode.
5 6 7 |
# File 'lib/tp_plus/nodes/digit_node.rb', line 5 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/tp_plus/nodes/digit_node.rb', line 4 def value @value end |
Instance Method Details
#eval(context, options = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/tp_plus/nodes/digit_node.rb', line 13 def eval(context, ={}) if @value < 0 "(#{@value})" else @value end end |
#requires_mixed_logic?(context) ⇒ Boolean
9 10 11 |
# File 'lib/tp_plus/nodes/digit_node.rb', line 9 def requires_mixed_logic?(context) false end |