class Forminator::Flow
Attributes
current_step[R]
steps[R]
Public Class Methods
new(steps:)
click to toggle source
# File lib/forminator/flow.rb, line 5 def initialize(steps:) @steps = steps @current_step = initial_step end
Public Instance Methods
add(step:)
click to toggle source
# File lib/forminator/flow.rb, line 23 def add(step:) raise Forminator::InvalidStep unless step.ancestors.include?(Forminator::Step) steps << step end
initial_step()
click to toggle source
# File lib/forminator/flow.rb, line 19 def initial_step steps.first end
next_step()
click to toggle source
# File lib/forminator/flow.rb, line 10 def next_step steps[steps.index(current_step) + 1] end
previous_step()
click to toggle source
# File lib/forminator/flow.rb, line 14 def previous_step # TODO: there is no previous step?? steps[steps.index(current_step) - 1] end
remove(step:)
click to toggle source
# File lib/forminator/flow.rb, line 28 def remove(step:) steps.delete(step) end