Class: Sonic::UI

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

Constant Summary collapse

@@mute =
false
@@noop =
false

Class Method Summary collapse

Class Method Details

.error(msg = '') ⇒ Object



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

def error(msg='')
  say "ERROR: #{msg}".color(:red)
end

.muteObject



5
6
7
# File 'lib/sonic/ui.rb', line 5

def mute
  @@mute
end

.mute=(v) ⇒ Object



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

def mute=(v)
  @@mute=v
end

.noop=(v) ⇒ Object



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

def noop=(v)
  @@noop=v
end

.say(msg = '') ⇒ Object



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

def say(msg='')
  msg = "NOOP: #{msg}" if @@noop
  puts msg unless mute
end

.warn(msg = '') ⇒ Object



24
25
26
# File 'lib/sonic/ui.rb', line 24

def warn(msg='')
  say "WARN: #{msg}".color(:yellow)
end