Module: ActionSegue::SegueRegistration
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/action_segue/segue_registration.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#clear_segue(id) ⇒ Object
Remove a segue from the stack.
-
#complete_current_segue_url(fallback:) ⇒ Object
Completes the last segue, regardless of what it was.
-
#complete_segue_url(id, fallback:) ⇒ Object
Completes the segue and returns either the params to redirect to the segue start point, all the fallback if the segue is not in progress.
Instance Method Details
#clear_segue(id) ⇒ Object
Remove a segue from the stack
29 30 31 32 |
# File 'lib/action_segue/segue_registration.rb', line 29 def clear_segue(id) Rails.logger.debug "[ActionSegue] clearing segue '#{id}'" session[:action_segues].delete id end |
#complete_current_segue_url(fallback:) ⇒ Object
Completes the last segue, regardless of what it was
35 36 37 |
# File 'lib/action_segue/segue_registration.rb', line 35 def complete_current_segue_url(fallback:) complete_segue_url session[:action_segues].try(:keys).try(:last), fallback: fallback end |
#complete_segue_url(id, fallback:) ⇒ Object
Completes the segue and returns either the params to redirect to the segue start point, all the fallback if the segue is not in progress.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/action_segue/segue_registration.rb', line 17 def complete_segue_url(id, fallback:) if session[:action_segues].present? && session[:action_segues][id].present? segue = clear_segue id Rails.logger.debug "[ActionSegue] completed '#{id}'" url_for segue.params else Rails.logger.debug "[ActionSegue] no segue matched '#{id}'" fallback end end |