Sha256: 931ef986b5639a3bc0d4f160c265db14b8c38d6d13e52889c83fa12083687162
Contents?: true
Size: 703 Bytes
Versions: 3
Compression:
Stored size: 703 Bytes
Contents
module Runbook class Toolbox attr_reader :prompt def initialize @prompt = TTY::Prompt.new end def ask(msg, default: nil) prompt.ask(msg, default: default) end def expand(msg, choices) prompt.expand(msg, choices) end def yes?(msg) begin prompt.yes?(msg) rescue TTY::Prompt::ConversionError err_msg = "Unknown input: Please type 'y' or 'n'." warn(err_msg) retry end end def output(msg) prompt.say(msg) end def warn(msg) prompt.warn(msg) end def error(msg) prompt.error(msg) end def exit(return_value) super(return_value) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
runbook-0.14.0 | lib/runbook/toolbox.rb |
runbook-0.13.0 | lib/runbook/toolbox.rb |
runbook-0.12.1 | lib/runbook/toolbox.rb |