From 280b4ac8ba5dd51939822670c02f845dd6f22519 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 3 Dec 2023 11:39:29 +0100 Subject: [PATCH] init first last step --- lib/wicked/wizard.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/wicked/wizard.rb b/lib/wicked/wizard.rb index f0ffbcc..b266b9d 100644 --- a/lib/wicked/wizard.rb +++ b/lib/wicked/wizard.rb @@ -49,10 +49,17 @@ def wizard_value(step_name) @wicked_redirect_params = nil end + private def check_first_last_step!(step) + return steps.first if step.to_s == Wicked::FIRST_STEP + return steps.last if step.to_s == Wicked::LAST_STEP + return step + end + private def setup_step_from(the_step) return if steps.nil? the_step ||= steps.first + the_step = check_first_last_step!(the_step) valid_steps = steps + self.class::PROTECTED_STEPS resolved_step = valid_steps.detect { |stp| stp.to_s == the_step }