Class: TPPlus::Nodes::IndirectNode

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

Instance Method Summary collapse

Methods inherited from BaseNode

#can_be_inlined?

Constructor Details

#initialize(type, target) ⇒ IndirectNode

Returns a new instance of IndirectNode.



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

def initialize(type, target)
  @type   = type
  @target = target
end

Instance Method Details

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



15
16
17
18
19
20
21
22
23
24
# File 'lib/tp_plus/nodes/indirect_node.rb', line 15

def eval(context,options={})
  s = "#{@type.upcase}[#{@target.eval(context)}]"
  if options[:opposite]
    s = "!#{s}"
  end
  if options[:as_condition]
    s = "(#{s})"
  end
  s
end

#requires_mixed_logic?(context) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'lib/tp_plus/nodes/indirect_node.rb', line 9

def requires_mixed_logic?(context)
  return true if @type == :f

  false
end