Class: TPPlus::Nodes::TimeNode

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

Instance Method Summary collapse

Constructor Details

#initialize(type, time, action) ⇒ TimeNode

Returns a new instance of TimeNode.



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

def initialize(type, time, action)
  @type = type
  @time = time
  @action = action
end

Instance Method Details

#eval(context) ⇒ Object



19
20
21
# File 'lib/tp_plus/nodes/time_node.rb', line 19

def eval(context)
  "#{type} #{@time.eval(context,as_string: true)}sec,#{@action.eval(context)}"
end

#typeObject



10
11
12
13
14
15
16
17
# File 'lib/tp_plus/nodes/time_node.rb', line 10

def type
  case @type.downcase
  when "time_before"
    "TB"
  when "time_after"
    "TA"
  end
end