Module: Stepable

Instance Method Summary collapse

Instance Method Details

#execute_stepsObject


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/concerns/stepable.rb', line 10

def execute_steps
  initial_result = {}

  steps.inject(initial_result) do |previous_result, callback|
    result = method(callback).call(previous_result)

    if result[:status] != :success
      result[:last_step] = callback

      break result
    end

    result
  end
end

#stepsObject


6
7
8
# File 'app/models/concerns/stepable.rb', line 6

def steps
  self.class._all_steps
end