Class: Rocksteady::Scenario
- Inherits:
-
Object
- Object
- Rocksteady::Scenario
- Defined in:
- lib/rocksteady/scenario.rb
Instance Attribute Summary collapse
-
#corpus ⇒ Object
readonly
Returns the value of attribute corpus.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(corpus, title, &operation) ⇒ Scenario
constructor
A new instance of Scenario.
- #name ⇒ Object
- #result ⇒ Object (also: #run!)
- #schedule! ⇒ Object
Constructor Details
Instance Attribute Details
#corpus ⇒ Object (readonly)
Returns the value of attribute corpus.
5 6 7 |
# File 'lib/rocksteady/scenario.rb', line 5 def corpus @corpus end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
5 6 7 |
# File 'lib/rocksteady/scenario.rb', line 5 def operation @operation end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/rocksteady/scenario.rb', line 5 def title @title end |
Instance Method Details
#name ⇒ Object
16 17 18 |
# File 'lib/rocksteady/scenario.rb', line 16 def name @name ||= title.gsub(/[^[:alnum:]]+/, '_').downcase end |
#result ⇒ Object Also known as: run!
20 21 22 23 24 25 26 |
# File 'lib/rocksteady/scenario.rb', line 20 def result @result ||= begin operation.call rescue Exception => e e end end |
#schedule! ⇒ Object
12 13 14 |
# File 'lib/rocksteady/scenario.rb', line 12 def schedule! corpus.schedule << self end |