Class: Step

Inherits:
Object
  • Object
show all
Defined in:
lib/step.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options, &block) ⇒ Step

Returns a new instance of Step.



4
5
6
7
8
9
# File 'lib/step.rb', line 4

def initialize(name, options, &block)
  @name = name
  @actions = []
  @options = options
  instance_exec(&block) if block_given?
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



2
3
4
# File 'lib/step.rb', line 2

def actions
  @actions
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/step.rb', line 2

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



2
3
4
# File 'lib/step.rb', line 2

def options
  @options
end

Instance Method Details

#action(name, &block) ⇒ Object



11
12
13
14
# File 'lib/step.rb', line 11

def action(name, &block)
  action = Action.new(name, self.name, options, &block)
  actions << action
end

#runObject



16
17
18
19
# File 'lib/step.rb', line 16

def run
  # puts "Running step: #{name}"
  actions.each(&:run)
end