Class: LeafTasks::Wait

Inherits:
Task
  • Object
show all
Defined in:
lib/behave_fun/leaf_tasks/wait.rb

Constant Summary collapse

ParamsSchema =
Types::Hash.schema(
  duration: Types::Coercible::Integer
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#counterObject

Returns the value of attribute counter.



3
4
5
# File 'lib/behave_fun/leaf_tasks/wait.rb', line 3

def counter
  @counter
end

Instance Method Details

#executeObject



10
11
12
13
14
15
16
17
# File 'lib/behave_fun/leaf_tasks/wait.rb', line 10

def execute
  if @counter < params[:duration]
    @counter += 1
    running
  else
    success
  end
end

#params=(params) ⇒ Object



23
24
25
# File 'lib/behave_fun/leaf_tasks/wait.rb', line 23

def params=(params)
  @params = ParamsSchema[params]
end

#serializable_status_fieldsObject



19
20
21
# File 'lib/behave_fun/leaf_tasks/wait.rb', line 19

def serializable_status_fields
  [:counter]
end

#startObject



5
6
7
8
# File 'lib/behave_fun/leaf_tasks/wait.rb', line 5

def start
  super
  @counter = 0
end