Class: Strobe::UI::Basic

Inherits:
Object
  • Object
show all
Defined in:
lib/strobe/ui.rb

Direct Known Subclasses

Shell

Instance Method Summary collapse

Instance Method Details

#ask(message) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/strobe/ui.rb', line 39

def ask(message)
  highline.ask(message) do |q|
    next unless STDIN.tty?
    q.readline = true
  end
rescue EOFError
  ''
end

#confirm(msg) ⇒ Object



14
15
16
# File 'lib/strobe/ui.rb', line 14

def confirm(msg)
  puts msg
end

#debug(msg) ⇒ Object



6
7
8
# File 'lib/strobe/ui.rb', line 6

def debug(msg)
  puts msg
end

#error(msg) ⇒ Object



22
23
24
# File 'lib/strobe/ui.rb', line 22

def error(msg)
  puts msg
end

#highlineObject



26
27
28
# File 'lib/strobe/ui.rb', line 26

def highline
  @highline ||= HighLine.new
end

#info(msg) ⇒ Object



10
11
12
# File 'lib/strobe/ui.rb', line 10

def info(msg)
  puts msg
end

#password(message) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/strobe/ui.rb', line 30

def password(message)
  highline.ask(message) do |q|
    next unless STDIN.tty?
    q.echo = "*"
  end
rescue EOFError
  ''
end

#warn(msg) ⇒ Object



18
19
20
# File 'lib/strobe/ui.rb', line 18

def warn(msg)
  puts msg
end