Class: Gitflash::Prompt
- Inherits:
-
TTY::Prompt
- Object
- TTY::Prompt
- Gitflash::Prompt
- Defined in:
- lib/gitflash/prompt.rb
Overview
A wrapper class for TTY::Prompt gem
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Prompt
constructor
A new instance of Prompt.
- #multi_select(message, collection, options = {}) ⇒ Object
- #proceed_with_warning(message, &block) ⇒ Object
- #select(message, collection, options = {}) ⇒ Object
Constructor Details
#initialize(options) ⇒ Prompt
Returns a new instance of Prompt.
14 15 16 |
# File 'lib/gitflash/prompt.rb', line 14 def initialize() super(**()) end |
Class Method Details
.create(options: {}) ⇒ Object
9 10 11 |
# File 'lib/gitflash/prompt.rb', line 9 def create(options: {}) new() end |
Instance Method Details
#multi_select(message, collection, options = {}) ⇒ Object
22 23 24 |
# File 'lib/gitflash/prompt.rb', line 22 def multi_select(, collection, = {}) super(, collection, ()) end |
#proceed_with_warning(message, &block) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/gitflash/prompt.rb', line 26 def proceed_with_warning(, &block) raise ArgumentError, 'A block is required for this method' unless block_given? warn() answer = yes?('Do you want to proceed?') answer ? block.call : 'Exited' end |
#select(message, collection, options = {}) ⇒ Object
18 19 20 |
# File 'lib/gitflash/prompt.rb', line 18 def select(, collection, = {}) super(, collection, ()) end |