Class: Clacky::UIInterface::LegacyProgressHandleAdapter
- Inherits:
-
Object
- Object
- Clacky::UIInterface::LegacyProgressHandleAdapter
- Defined in:
- lib/clacky/ui_interface.rb
Overview
Minimal adapter that lets UIs without a native ProgressHandle still
participate in the new with_progress API by delegating to the old
show_progress(phase: ...) contract. UI2::UIController overrides
start_progress directly with a native ProgressHandle, so this
adapter is only used by plain/json/web/channel UIs.
Instance Method Summary collapse
- #finish(final_message: nil) ⇒ Object (also: #cancel)
-
#initialize(ui, progress_type:) ⇒ LegacyProgressHandleAdapter
constructor
A new instance of LegacyProgressHandleAdapter.
- #update(message: nil, metadata: nil) ⇒ Object
Constructor Details
#initialize(ui, progress_type:) ⇒ LegacyProgressHandleAdapter
Returns a new instance of LegacyProgressHandleAdapter.
108 109 110 111 112 |
# File 'lib/clacky/ui_interface.rb', line 108 def initialize(ui, progress_type:) @ui = ui @progress_type = progress_type @closed = false end |
Instance Method Details
#finish(final_message: nil) ⇒ Object Also known as: cancel
119 120 121 122 123 |
# File 'lib/clacky/ui_interface.rb', line 119 def finish(final_message: nil) return if @closed @closed = true @ui.show_progress(, progress_type: @progress_type, phase: "done") end |
#update(message: nil, metadata: nil) ⇒ Object
114 115 116 117 |
# File 'lib/clacky/ui_interface.rb', line 114 def update(message: nil, metadata: nil) return if @closed @ui.show_progress(, progress_type: @progress_type, phase: "active", metadata: || {}) end |