Class: Crusher::Configurator::Scenario
- Inherits:
-
Object
- Object
- Crusher::Configurator::Scenario
- Defined in:
- lib/crusher/configurator.rb
Instance Attribute Summary collapse
-
#launch_jobs ⇒ Object
readonly
Returns the value of attribute launch_jobs.
-
#phases ⇒ Object
readonly
Returns the value of attribute phases.
Instance Method Summary collapse
- #duration(new_duration = nil) ⇒ Object
-
#initialize(*args, &block) ⇒ Scenario
constructor
A new instance of Scenario.
- #launch(count, type, &block) ⇒ Object
- #phase(name, options = {}, &block) ⇒ Object
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_jobs ⇒ Object (readonly)
Returns the value of attribute launch_jobs.
39 40 41 |
# File 'lib/crusher/configurator.rb', line 39 def launch_jobs @launch_jobs end |
#phases ⇒ Object (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, = {}, &block) @phases << .merge( :name => name.to_s, :proc => block ) end |