Class: Plutonium::Wizard::Resume::ResumeUrl

Inherits:
Object
  • Object
show all
Defined in:
lib/plutonium/wizard/resume.rb

Overview

Resolves a single row to its resume + cancel URLs in the current portal.

Both URLs come from the SAME resolved mount, through named route helpers — the cancel target is never derived by string-surgery on the resume URL, which would drop query params and break for a run whose current_step is still nil (there the resume URL is the bare launch path, so lopping off its last segment yields a non-route).

Defined Under Namespace

Classes: Mount

Instance Method Summary collapse

Constructor Details

#initialize(row, wizard_class, view_context) ⇒ ResumeUrl

Returns a new instance of ResumeUrl.



136
137
138
139
140
# File 'lib/plutonium/wizard/resume.rb', line 136

def initialize(row, wizard_class, view_context)
  @row = row
  @wizard_class = wizard_class
  @view_context = view_context
end

Instance Method Details

#resolveHash

Returns cancel_url:, reason: — reason is non-nil exactly when no resume URL could be built. The two URLs resolve INDEPENDENTLY: a run with no current_step has no stepped resume URL, but is still perfectly cancellable, and leaving the user no way to clear it would strand the row in their chooser forever.

Returns:

  • (Hash)

    cancel_url:, reason: — reason is non-nil exactly when no resume URL could be built. The two URLs resolve INDEPENDENTLY: a run with no current_step has no stepped resume URL, but is still perfectly cancellable, and leaving the user no way to clear it would strand the row in their chooser forever.



147
148
149
150
151
152
# File 'lib/plutonium/wizard/resume.rb', line 147

def resolve
  return {url: nil, cancel_url: nil, reason: unresolved_reason} if mount.nil?

  url = build_step_url(mount)
  {url: url, cancel_url: build_cancel_url(mount), reason: url.nil? ? unresolved_reason : nil}
end