Module: Wizardry::Base::WizardryMethods
- Defined in:
- lib/wizardry/base.rb
Instance Method Summary collapse
- #current_step ⇒ Object
- #current_step=(step) ⇒ Object
- #next_step ⇒ Object
- #previous_step ⇒ Object
- #step_title(step = current_step) ⇒ Object
Instance Method Details
#current_step ⇒ Object
29 30 31 |
# File 'lib/wizardry/base.rb', line 29 def current_step @current_step ||= first_step end |
#current_step=(step) ⇒ Object
33 34 35 36 |
# File 'lib/wizardry/base.rb', line 33 def current_step=(step) step = step.to_s @current_step = step.inquiry if steps.include?(step) end |
#next_step ⇒ Object
38 39 40 |
# File 'lib/wizardry/base.rb', line 38 def next_step steps[current_step_idx + 1] unless last_step? end |
#previous_step ⇒ Object
42 43 44 |
# File 'lib/wizardry/base.rb', line 42 def previous_step steps[current_step_idx - 1] unless first_step? end |
#step_title(step = current_step) ⇒ Object
46 47 48 49 |
# File 'lib/wizardry/base.rb', line 46 def step_title(step = current_step) return nil if step !~ steps_regexp I18n.translate(step, scope: 'wizardry.steps', default: step.to_s.humanize) end |