Class: Volley::Dsl::Stage

Inherits:
Object
  • Object
show all
Defined in:
lib/volley/dsl/stage.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}, &block) ⇒ Stage

Returns a new instance of Stage.



6
7
8
9
10
11
12
13
14
# File 'lib/volley/dsl/stage.rb', line 6

def initialize(name, options={}, &block)
  @name = name.to_sym
  @plan = options.delete(:plan)
  @options = {
  }.merge(options)
  @actions = []
  raise "plan instance must be set" unless @plan
  instance_eval &block if block_given?
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



5
6
7
# File 'lib/volley/dsl/stage.rb', line 5

def actions
  @actions
end

Instance Method Details

#action(name, options = {}, &block) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/volley/dsl/stage.rb', line 30

def action(name, options={}, &block)
  o = {
      :stage => @name,
      :plan => nil,
  }.merge(options)
  @actions << Volley::Dsl::Action.new(name, o, &block)
end

#add(action) ⇒ Object



22
23
24
# File 'lib/volley/dsl/stage.rb', line 22

def add(action)
  @actions << action
end

#callObject



16
17
18
19
20
# File 'lib/volley/dsl/stage.rb', line 16

def call
  @actions.each do |action|
    action.call
  end
end

#countObject



26
27
28
# File 'lib/volley/dsl/stage.rb', line 26

def count
  @actions.count
end