Class: Bosh::Cli::Terminal

Inherits:
Object show all
Extended by:
Forwardable
Defined in:
lib/cli/terminal.rb

Instance Method Summary collapse

Constructor Details

#initialize(highline, sayer) ⇒ Terminal

Returns a new instance of Terminal


6
7
8
9
# File 'lib/cli/terminal.rb', line 6

def initialize(highline, sayer)
  @highline = highline
  @sayer = sayer
end

Instance Method Details

#ask(prompt) ⇒ Object


11
12
13
# File 'lib/cli/terminal.rb', line 11

def ask(prompt)
  highline.ask(prompt).to_s # make sure we return a String not a HighLine::String
end

#ask_password(prompt) ⇒ Object


15
16
17
# File 'lib/cli/terminal.rb', line 15

def ask_password(prompt)
  highline.ask(prompt) { |q| q.echo = false }.to_s
end

#say_green(message) ⇒ Object


19
20
21
# File 'lib/cli/terminal.rb', line 19

def say_green(message)
  sayer.say(message.make_green)
end

#say_red(message) ⇒ Object


23
24
25
# File 'lib/cli/terminal.rb', line 23

def say_red(message)
  sayer.say(message.make_red)
end