Class: CapitaGit::UI::Shell

Inherits:
CapitaGit::UI show all
Defined in:
lib/capita_git/ui.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell) ⇒ Shell

Returns a new instance of Shell.



23
24
25
26
27
# File 'lib/capita_git/ui.rb', line 23

def initialize(shell)
  @shell = shell
  @quiet = false
  @debug = ENV['DEBUG']
end

Instance Attribute Details

#shellObject

Returns the value of attribute shell.



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

def shell
  @shell
end

Instance Method Details

#be_quiet!Object



49
50
51
# File 'lib/capita_git/ui.rb', line 49

def be_quiet!
  @quiet = true
end

#confirm(msg) ⇒ Object



37
38
39
# File 'lib/capita_git/ui.rb', line 37

def confirm(msg)
  @shell.say(msg, :green) if !@quiet
end

#debug(msg) ⇒ Object



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

def debug(msg)
  @shell.say(msg) if @debug && !@quiet
end

#debug!Object



53
54
55
# File 'lib/capita_git/ui.rb', line 53

def debug!
  @debug = true
end

#error(msg) ⇒ Object



45
46
47
# File 'lib/capita_git/ui.rb', line 45

def error(msg)
  @shell.say(msg, :red)
end

#info(msg) ⇒ Object



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

def info(msg)
  @shell.say(msg) if !@quiet
end

#warn(msg) ⇒ Object



41
42
43
# File 'lib/capita_git/ui.rb', line 41

def warn(msg)
  @shell.say(msg, :yellow)
end