class Stairway::Stairs

Attributes

name[RW]

Public Class Methods

new(name) click to toggle source
# File lib/stairway/stairs.rb, line 9
def initialize(name)
  @name = name
end

Public Instance Methods

run(context={}, options={}) click to toggle source
# File lib/stairway/stairs.rb, line 25
def run(context={}, options={})
  notify(context, options)

  @steps.each do |name, klass|
    begin
      klass.run
      notify(klass.context, klass.options)
    rescue Stairway::Stop
      exit
    end
  end
end
run_step(name, context={}, options={}) click to toggle source
# File lib/stairway/stairs.rb, line 38
def run_step(name, context={}, options={})
  notify(context, options)

  @steps[name].run
end
steps() click to toggle source
# File lib/stairway/stairs.rb, line 13
def steps
  @steps
end
steps=(steps) click to toggle source
# File lib/stairway/stairs.rb, line 17
def steps=(steps)
  @steps = steps

  @steps.each do |name, klass|
    add_observer(klass)
  end
end

Protected Instance Methods

notify(context, options) click to toggle source
# File lib/stairway/stairs.rb, line 46
def notify(context, options)
  changed
  notify_observers(context, options)
end