Class: Screenplay::Scenario

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/screenplay/scenario.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



18
19
20
# File 'lib/screenplay/scenario.rb', line 18

def name
  @name
end

Instance Method Details

#eachObject



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

#sizeObject



36
37
38
# File 'lib/screenplay/scenario.rb', line 36

def size
  @actions.size
end