Class: Burr::UI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUI

Returns a new instance of UI.



8
9
10
11
# File 'lib/burr/ui.rb', line 8

def initialize
  Thor::Base.shell = Thor::Shell::Basic if !STDOUT.tty?
  @shell = Thor::Base.shell.new
end

Instance Attribute Details

#shellObject

Returns the value of attribute shell.



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

def shell
  @shell
end

Instance Method Details

#confirm(msg, newline = nil) ⇒ Object



17
18
19
# File 'lib/burr/ui.rb', line 17

def confirm(msg, newline = nil)
  tell_me(msg, :green, newline)
end

#debug(msg, newline = nil) ⇒ Object



29
30
31
# File 'lib/burr/ui.rb', line 29

def debug(msg, newline = nil)
  tell_me(msg, nil, newline) if debug?
end

#error(msg, newline = nil) ⇒ Object



25
26
27
# File 'lib/burr/ui.rb', line 25

def error(msg, newline = nil)
  tell_me(msg, :red, newline)
end

#info(msg, newline = nil) ⇒ Object



13
14
15
# File 'lib/burr/ui.rb', line 13

def info(msg, newline = nil)
  tell_me(msg, nil, newline)
end

#trace(e, newline = nil) ⇒ Object



33
34
35
36
# File 'lib/burr/ui.rb', line 33

def trace(e, newline = nil)
  msg = ["#{e.class}: #{e.message}", *e.backtrace].join("\n")
  tell_me(msg, nil, newline)
end

#warn(msg, newline = nil) ⇒ Object



21
22
23
# File 'lib/burr/ui.rb', line 21

def warn(msg, newline = nil)
  tell_me(msg, :yellow, newline)
end