Class: Bolt::Plugin::Prompt
- Inherits:
-
Object
- Object
- Bolt::Plugin::Prompt
- Defined in:
- lib/bolt/plugin/prompt.rb
Instance Method Summary collapse
- #hooks ⇒ Object
-
#initialize(*_args) ⇒ Prompt
constructor
A new instance of Prompt.
- #name ⇒ Object
- #resolve_reference(opts) ⇒ Object
- #validate_resolve_reference(opts) ⇒ Object
Constructor Details
#initialize(*_args) ⇒ Prompt
Returns a new instance of Prompt.
7 |
# File 'lib/bolt/plugin/prompt.rb', line 7 def initialize(*_args); end |
Instance Method Details
#hooks ⇒ Object
13 14 15 |
# File 'lib/bolt/plugin/prompt.rb', line 13 def hooks [:resolve_reference] end |
#name ⇒ Object
9 10 11 |
# File 'lib/bolt/plugin/prompt.rb', line 9 def name 'prompt' end |
#resolve_reference(opts) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/bolt/plugin/prompt.rb', line 21 def resolve_reference(opts) # rubocop:disable Style/GlobalVars $future ? STDERR.print("#{opts['message']}: ") : STDOUT.print("#{opts['message']}: ") value = STDIN.noecho(&:gets).chomp $future ? STDERR.puts : STDOUT.puts # rubocop:enable Style/GlobalVars value end |
#validate_resolve_reference(opts) ⇒ Object
17 18 19 |
# File 'lib/bolt/plugin/prompt.rb', line 17 def validate_resolve_reference(opts) raise Bolt::ValidationError, "Prompt requires a 'message'" unless opts['message'] end |