Class: TPPlus::Nodes::RealNode
- Inherits:
-
Object
- Object
- TPPlus::Nodes::RealNode
- Defined in:
- lib/tp_plus/nodes/real_node.rb
Instance Method Summary collapse
- #eval(context, options = {}) ⇒ Object
-
#initialize(value) ⇒ RealNode
constructor
A new instance of RealNode.
- #requires_mixed_logic?(context) ⇒ Boolean
Constructor Details
#initialize(value) ⇒ RealNode
Returns a new instance of RealNode.
4 5 6 |
# File 'lib/tp_plus/nodes/real_node.rb', line 4 def initialize(value) @value = value end |
Instance Method Details
#eval(context, options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tp_plus/nodes/real_node.rb', line 12 def eval(context,={}) val = if [:as_string] ("%.2f" % @value).sub(/^0/,'') else @value end if @value < 0 "(#{val})" else val end end |
#requires_mixed_logic?(context) ⇒ Boolean
8 9 10 |
# File 'lib/tp_plus/nodes/real_node.rb', line 8 def requires_mixed_logic?(context) false end |