Class: WurflDevice::UI::Shell

Inherits:
WurflDevice::UI show all
Defined in:
lib/wurfl_device/ui.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell) ⇒ Shell

Returns a new instance of Shell.



24
25
26
27
28
# File 'lib/wurfl_device/ui.rb', line 24

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

Instance Attribute Details

#shell=(value) ⇒ Object (writeonly)

Sets the attribute shell

Parameters:

  • value

    the value to set the attribute shell to.



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

def shell=(value)
  @shell = value
end

Instance Method Details

#be_quiet!Object



50
51
52
# File 'lib/wurfl_device/ui.rb', line 50

def be_quiet!
  @quiet = true
end

#confirm(msg) ⇒ Object



38
39
40
# File 'lib/wurfl_device/ui.rb', line 38

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

#debug(msg) ⇒ Object



30
31
32
# File 'lib/wurfl_device/ui.rb', line 30

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

#debug!Object



54
55
56
# File 'lib/wurfl_device/ui.rb', line 54

def debug!
  @debug = true
end

#error(msg) ⇒ Object



46
47
48
# File 'lib/wurfl_device/ui.rb', line 46

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

#info(msg) ⇒ Object



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

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

#warn(msg) ⇒ Object



42
43
44
# File 'lib/wurfl_device/ui.rb', line 42

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