module Wicked::Wizard::Validations
Constants
- VERSION
Attributes
current_step_method[RW]
Set up a class-level instance method to hold the name of a method to call to get the current_step for this model.
wizard_steps_method[RW]
Set up a class-level instance method to hold the name of a method to call to get the current_step for this model.
Public Instance Methods
current_and_previous_wizard_steps()
click to toggle source
@return [Array] an ordered list of wizard steps, up to and including this one
# File lib/wicked/wizard/validations.rb, line 104 def current_and_previous_wizard_steps previous_wizard_steps.push(current_wizard_step.to_sym) end
current_wizard_step()
click to toggle source
Get the current wizard step by calling the instance method specified in the class; fall back to calling `current_step` on the instance.
# File lib/wicked/wizard/validations.rb, line 82 def current_wizard_step meth = self.class.current_step_method if meth.present? case meth.class.to_s when "Symbol" self.send(meth) else raise ArgumentError, "current_step_method accepts a symbol, which should be the name of a callable instance method" end else #assume the method is called current_step() and call that current_step end end
previous_wizard_steps()
click to toggle source
Call the `previous_wizard_steps` class method, passing in the current step for this instance @return [Array] an ordered list of wizard steps which happen before the current one
# File lib/wicked/wizard/validations.rb, line 99 def previous_wizard_steps self.class.previous_wizard_steps(current_wizard_step.to_sym) end