Class: Screenplay::Scenario
- Inherits:
-
Object
- Object
- Screenplay::Scenario
- Includes:
- Enumerable
- Defined in:
- lib/screenplay/scenario.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(name, filename) ⇒ Scenario
constructor
A new instance of Scenario.
- #size ⇒ Object
Constructor Details
#initialize(name, filename) ⇒ Scenario
Returns a new instance of Scenario.
20 21 22 23 24 |
# File 'lib/screenplay/scenario.rb', line 20 def initialize(name, filename) @name = name @actions = YAML.load_file(filename) @actions.symbolize_keys! end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/screenplay/scenario.rb', line 18 def name @name end |
Instance Method Details
#each ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/screenplay/scenario.rb', line 26 def each @actions.each { | action | next if action.nil? action = { action => {} } if action.is_a?(String) actor = action.keys[0] data = action[actor] || {} yield actor, data } end |
#size ⇒ Object
36 37 38 |
# File 'lib/screenplay/scenario.rb', line 36 def size @actions.size end |