Module: Onboardable::List::Navigation
- Included in:
- Base
- Defined in:
- lib/onboardable/list/navigation.rb
Overview
The Navigation module provides methods for navigating through the steps of the onboarding process.
Instance Method Summary collapse
-
#current_step?(step) ⇒ Boolean
Checks if the specified step is the current step in the onboarding process.
-
#first_step ⇒ Step
Retrieves the first step in the onboarding process.
-
#first_step?(step = current_step) ⇒ Boolean
Checks if the specified step is the first step in the onboarding process.
-
#last_step ⇒ Step
Retrieves the last step in the onboarding process.
-
#last_step?(step = current_step) ⇒ Boolean
Checks if the specified step is the last step in the onboarding process.
-
#next_step ⇒ Step?
Returns the next step in the onboarding process.
-
#next_step! ⇒ Step
Moves the current step pointer to the next step in the onboarding process.
-
#next_step?(step) ⇒ Boolean
Checks if the specified step is the next step in the onboarding process.
-
#prev_step ⇒ Step?
Returns the previous step in the onboarding process.
-
#prev_step! ⇒ Step
Moves the current step pointer to the previous step in the onboarding process.
-
#prev_step?(step) ⇒ Boolean
Checks if the specified step is the previous step in the onboarding process.
Instance Method Details
#current_step?(step) ⇒ Boolean
Checks if the specified step is the current step in the onboarding process.
80 81 82 |
# File 'lib/onboardable/list/navigation.rb', line 80 def current_step?(step) current_step == step end |
#first_step ⇒ Step
Retrieves the first step in the onboarding process.
72 73 74 |
# File 'lib/onboardable/list/navigation.rb', line 72 def first_step steps.fetch(0) end |
#first_step?(step = current_step) ⇒ Boolean
Checks if the specified step is the first step in the onboarding process.
57 58 59 |
# File 'lib/onboardable/list/navigation.rb', line 57 def first_step?(step = current_step) first_step == step end |
#last_step ⇒ Step
Retrieves the last step in the onboarding process.
87 88 89 |
# File 'lib/onboardable/list/navigation.rb', line 87 def last_step steps.fetch(-1) end |
#last_step?(step = current_step) ⇒ Boolean
Checks if the specified step is the last step in the onboarding process.
65 66 67 |
# File 'lib/onboardable/list/navigation.rb', line 65 def last_step?(step = current_step) last_step == step end |
#next_step ⇒ Step?
Returns the next step in the onboarding process.
10 11 12 13 |
# File 'lib/onboardable/list/navigation.rb', line 10 def next_step current_index = step_index(current_step) steps[current_index.next] end |
#next_step! ⇒ Step
Moves the current step pointer to the next step in the onboarding process.
26 27 28 |
# File 'lib/onboardable/list/navigation.rb', line 26 def next_step! self.current_step = next_step || last_step_error! end |
#next_step?(step) ⇒ Boolean
Checks if the specified step is the next step in the onboarding process.
19 20 21 |
# File 'lib/onboardable/list/navigation.rb', line 19 def next_step?(step) next_step == step end |
#prev_step ⇒ Step?
Returns the previous step in the onboarding process.
33 34 35 36 |
# File 'lib/onboardable/list/navigation.rb', line 33 def prev_step current_index = step_index(current_step) current_index.positive? ? steps[current_index.pred] : nil end |
#prev_step! ⇒ Step
Moves the current step pointer to the previous step in the onboarding process.
49 50 51 |
# File 'lib/onboardable/list/navigation.rb', line 49 def prev_step! self.current_step = prev_step || first_step_error! end |
#prev_step?(step) ⇒ Boolean
Checks if the specified step is the previous step in the onboarding process.
42 43 44 |
# File 'lib/onboardable/list/navigation.rb', line 42 def prev_step?(step) prev_step == step end |