Class: Runbook::Toolbox

Inherits:
Object
  • Object
show all
Defined in:
lib/runbook/toolbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeToolbox

Returns a new instance of Toolbox.



5
6
7
# File 'lib/runbook/toolbox.rb', line 5

def initialize
  @prompt = TTY::Prompt.new
end

Instance Attribute Details

#promptObject (readonly)

Returns the value of attribute prompt.



3
4
5
# File 'lib/runbook/toolbox.rb', line 3

def prompt
  @prompt
end

Instance Method Details

#ask(msg, default: nil, echo: true) ⇒ Object



9
10
11
# File 'lib/runbook/toolbox.rb', line 9

def ask(msg, default: nil, echo: true)
  prompt.ask(msg, default: default, echo: echo)
end

#error(msg) ⇒ Object



29
30
31
# File 'lib/runbook/toolbox.rb', line 29

def error(msg)
  prompt.error(msg)
end

#exit(return_value) ⇒ Object



33
34
35
# File 'lib/runbook/toolbox.rb', line 33

def exit(return_value)
  super(return_value)
end

#expand(msg, choices) ⇒ Object



13
14
15
# File 'lib/runbook/toolbox.rb', line 13

def expand(msg, choices)
  prompt.expand(msg, choices)
end

#output(msg) ⇒ Object



21
22
23
# File 'lib/runbook/toolbox.rb', line 21

def output(msg)
  prompt.say(msg)
end

#warn(msg) ⇒ Object



25
26
27
# File 'lib/runbook/toolbox.rb', line 25

def warn(msg)
  prompt.warn(msg)
end

#yes?(msg) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/runbook/toolbox.rb', line 17

def yes?(msg)
  prompt.yes?(msg)
end