Class: Rootage::Phase

Inherits:
Sequence
  • Object
show all
Defined in:
lib/rootage/action.rb

Overview

Phase is a sequence of action items.

Direct Known Subclasses

CommandPhase

Instance Attribute Summary

Attributes included from CollectionInterface

#table

Instance Method Summary collapse

Methods inherited from Sequence

#append, #clear, #configure, #copy, #exception, #get_process_context_class, #post, #pre, #preppend, set_process_context_class, #use

Methods included from CollectionInterface

#define, #find_item, included

Constructor Details

#initialize(name = nil) ⇒ Phase

Returns a new instance of Phase.



22
23
24
25
# File 'lib/rootage/action.rb', line 22

def initialize(name=nil)
  super()
  self.name = name
end

Instance Method Details

#execute(scenario) ⇒ void

This method returns an undefined value.

Execute all actions in this phase.

Parameters:

  • scenario (Scenario)

    a scenario owned this phase



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rootage/action.rb', line 32

def execute(scenario)
  err = PhaseTimeoutError.new(scenario.name, name)

  catch(:rootage_sequence_quit) do
    execute_pre(scenario)
    Timeout.timeout(option[:timeout], err) do
      execute_main(scenario) do |item|
        self.current_action = item
        err.action_name = item.name
      end
    end
    execute_post(scenario)
  end

  self.current_action = nil
end