Class: TPPlus::Nodes::DigitNode

Inherits:
Object
  • Object
show all
Defined in:
lib/tp_plus/nodes/digit_node.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ DigitNode

Returns a new instance of DigitNode.



4
5
6
# File 'lib/tp_plus/nodes/digit_node.rb', line 4

def initialize(value)
  @value = value
end

Instance Method Details

#eval(context, options = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/tp_plus/nodes/digit_node.rb', line 12

def eval(context, options={})
  if @value < 0
    "(#{@value})"
  else
    @value
  end
end

#requires_mixed_logic?(context) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/tp_plus/nodes/digit_node.rb', line 8

def requires_mixed_logic?(context)
  false
end