Class: Crusher::Configurator::Scenario

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &block) ⇒ Scenario

Returns a new instance of Scenario.



41
42
43
44
45
46
# File 'lib/crusher/configurator.rb', line 41

def initialize(*args, &block)
  @launch_jobs = []
  @phases = []
  @duration = nil
  block.call self, *args
end

Instance Attribute Details

#launch_jobsObject (readonly)

Returns the value of attribute launch_jobs.



39
40
41
# File 'lib/crusher/configurator.rb', line 39

def launch_jobs
  @launch_jobs
end

#phasesObject (readonly)

Returns the value of attribute phases.



39
40
41
# File 'lib/crusher/configurator.rb', line 39

def phases
  @phases
end

Instance Method Details

#duration(new_duration = nil) ⇒ Object



56
57
58
59
# File 'lib/crusher/configurator.rb', line 56

def duration(new_duration = nil)
  return @duration unless new_duration
  @duration = new_duration
end

#launch(count, type, &block) ⇒ Object



48
49
50
# File 'lib/crusher/configurator.rb', line 48

def launch(count, type, &block)
  @launch_jobs.push :type => type, :count => count, :proc => block
end

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



52
53
54
# File 'lib/crusher/configurator.rb', line 52

def phase(name, options = {}, &block)
  @phases << options.merge( :name => name.to_s, :proc => block )
end