Class: Step
- Inherits:
-
Object
- Object
- Step
- Defined in:
- lib/step.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #action(name, &block) ⇒ Object
-
#initialize(name, options, &block) ⇒ Step
constructor
A new instance of Step.
- #run ⇒ Object
Constructor Details
#initialize(name, options, &block) ⇒ Step
Returns a new instance of Step.
4 5 6 7 8 9 |
# File 'lib/step.rb', line 4 def initialize(name, , &block) @name = name @actions = [] @options = instance_exec(&block) if block_given? end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
2 3 4 |
# File 'lib/step.rb', line 2 def actions @actions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/step.rb', line 2 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
2 3 4 |
# File 'lib/step.rb', line 2 def @options end |
Instance Method Details
#action(name, &block) ⇒ Object
11 12 13 14 |
# File 'lib/step.rb', line 11 def action(name, &block) action = Action.new(name, self.name, , &block) actions << action end |
#run ⇒ Object
16 17 18 19 |
# File 'lib/step.rb', line 16 def run # puts "Running step: #{name}" actions.each(&:run) end |