Class: Battlestation::UI::Shell

Inherits:
Battlestation::UI show all
Defined in:
lib/battlestation/ui.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell) ⇒ Shell

Returns a new instance of Shell.



39
40
41
42
# File 'lib/battlestation/ui.rb', line 39

def initialize(shell)
  @shell = shell
  @quiet = false
end

Instance Attribute Details

#shell=(value) ⇒ Object (writeonly)

Sets the attribute shell

Parameters:

  • value

    the value to set the attribute shell to.



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

def shell=(value)
  @shell = value
end

Instance Method Details

#be_quiet!Object



95
96
97
# File 'lib/battlestation/ui.rb', line 95

def be_quiet!
  @quiet = true
end

#confirm(message, newline = nil) ⇒ Object



83
84
85
# File 'lib/battlestation/ui.rb', line 83

def confirm(message, newline = nil)
  tell_me(message, :green, newline) if !@quiet
end

#debug(message, newline = nil) ⇒ Object



71
72
73
# File 'lib/battlestation/ui.rb', line 71

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

#debug!Object



91
92
93
# File 'lib/battlestation/ui.rb', line 91

def debug!
  @debug = true
end

#debug?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/battlestation/ui.rb', line 87

def debug?
  !!@debug && !@quiet
end

#error(message, newline = nil) ⇒ Object



75
76
77
# File 'lib/battlestation/ui.rb', line 75

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

#fail(message, newline = nil) ⇒ Object



55
56
57
# File 'lib/battlestation/ui.rb', line 55

def fail(message, newline = nil)
  tell_me(" [FAIL] #{message}", :red, newline)
end

#group(title, &block) ⇒ Object



44
45
46
47
48
49
# File 'lib/battlestation/ui.rb', line 44

def group(title, &block)
  tell_me("> #{title}")
  tell_me("\n")
  yield
  tell_me("\n")
end

#info(message, newline = nil) ⇒ Object



79
80
81
# File 'lib/battlestation/ui.rb', line 79

def info(message, newline = nil)
  tell_me(message, nil, newline) if !@quiet
end

#notice(message, newline = nil) ⇒ Object



59
60
61
# File 'lib/battlestation/ui.rb', line 59

def notice(message, newline = nil)
  tell_me(" [INFO] #{message}", :blue, newline)
end

#okay(message, newline = nil) ⇒ Object



63
64
65
# File 'lib/battlestation/ui.rb', line 63

def okay(message, newline = nil)
  tell_me(" [OKAY] #{message}", :green, newline)
end

#todo(message, newline = nil) ⇒ Object



51
52
53
# File 'lib/battlestation/ui.rb', line 51

def todo(message, newline = nil)
  tell_me(" [TODO] #{message}", :cyan, newline)
end

#warn(message, newline = nil) ⇒ Object



67
68
69
# File 'lib/battlestation/ui.rb', line 67

def warn(message, newline = nil)
  tell_me(" [WARN] #{message}", :yellow, newline)
end