class TPPlus::Nodes::TimerMethodNode

Public Class Methods

new(method, target) click to toggle source
# File lib/tp_plus/nodes/timer_method_node.rb, line 4
def initialize(method, target)
  @method = method
  @target = target
end

Public Instance Methods

eval(context,options={}) click to toggle source
# File lib/tp_plus/nodes/timer_method_node.rb, line 17
def eval(context,options={})
  case @method
  when "start"
    "#{timer(context)}=START"
  when "stop"
    "#{timer(context)}=STOP"
  when "reset"
    "#{timer(context)}=RESET"
  when "restart"
    "#{timer(context)}=STOP ;\n#{timer(context)}=RESET ;\n#{timer(context)}=START"
  else
    raise "Invalid timer method (#{@method})"
  end
end
requires_mixed_logic?(context) click to toggle source
# File lib/tp_plus/nodes/timer_method_node.rb, line 9
def requires_mixed_logic?(context)
  true
end
timer(context) click to toggle source
# File lib/tp_plus/nodes/timer_method_node.rb, line 13
def timer(context)
  @timer ||= @target.eval(context)
end