Class: AutomationObject::State::ActionLoop

Inherits:
Object
  • Object
show all
Defined in:
lib/automation_object/state/hook_actions/action_loop.rb

Overview

Composite action loop base class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(composite, driver, blue_prints, loops = 30) ⇒ ActionLoop

Returns a new instance of ActionLoop

Parameters:



20
21
22
23
24
25
# File 'lib/automation_object/state/hook_actions/action_loop.rb', line 20

def initialize(composite, driver, blue_prints, loops = 30)
  self.composite = composite
  self.driver = driver
  self.blue_prints = blue_prints
  self.loops = loops
end

Instance Attribute Details

#blue_printsAutomationObject::BluePrint::Composite::Base



12
13
14
# File 'lib/automation_object/state/hook_actions/action_loop.rb', line 12

def blue_prints
  @blue_prints
end

#compositeAutomationObject::State::Base



8
9
10
# File 'lib/automation_object/state/hook_actions/action_loop.rb', line 8

def composite
  @composite
end

#driverAutomationObject::Driver::Driver



10
11
12
# File 'lib/automation_object/state/hook_actions/action_loop.rb', line 10

def driver
  @driver
end

#loopsInteger

Returns:

  • (Integer)


14
15
16
# File 'lib/automation_object/state/hook_actions/action_loop.rb', line 14

def loops
  @loops
end

Instance Method Details

#runBoolean

Returns run success or not

Returns:

  • (Boolean)

    run success or not



28
29
30
31
32
33
34
35
# File 'lib/automation_object/state/hook_actions/action_loop.rb', line 28

def run
  loops.times do
    # Sub classes implement single run
    return true if single_run
  end

  false
end

#single_runBoolean

Abstract method, override

Returns:

  • (Boolean)

    success or not

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/automation_object/state/hook_actions/action_loop.rb', line 39

def single_run
  raise NotImplementedError
end