Class: Clack::Prompts::Confirm
- Inherits:
-
Core::Prompt
- Object
- Core::Prompt
- Clack::Prompts::Confirm
- Defined in:
- lib/clack/prompts/confirm.rb
Overview
Yes/No confirmation prompt.
Displays a toggle between two options. Navigate with arrow keys, j/k, or press y/n to select directly.
Constant Summary
Constants inherited from Core::Prompt
Core::Prompt::MIN_TERMINAL_WIDTH
Instance Attribute Summary
Attributes inherited from Core::Prompt
#error_message, #state, #value, #warning_message
Instance Method Summary collapse
-
#initialize(message:, active: "Yes", inactive: "No", initial_value: true, **opts) ⇒ Confirm
constructor
A new instance of Confirm.
Methods inherited from Core::Prompt
flush_resize, register, #request_redraw, #run, setup_signal_handler, unregister
Constructor Details
#initialize(message:, active: "Yes", inactive: "No", initial_value: true, **opts) ⇒ Confirm
Returns a new instance of Confirm.
27 28 29 30 31 32 |
# File 'lib/clack/prompts/confirm.rb', line 27 def initialize(message:, active: "Yes", inactive: "No", initial_value: true, **opts) super(message:, **opts) @active_label = active @inactive_label = inactive @value = initial_value end |