Module: EacRubyUtils::Console::Speaker

Included in:
Envs::Command
Defined in:
lib/eac_ruby_utils/console/speaker.rb

Overview

Instance Method Summary collapse

Instance Method Details

#fatal_error(s) ⇒ Object



13
14
15
16
# File 'lib/eac_ruby_utils/console/speaker.rb', line 13

def fatal_error(s)
  puts "ERROR: #{s}".white.on_red
  Kernel.exit 1
end

#info(s) ⇒ Object



25
26
27
# File 'lib/eac_ruby_utils/console/speaker.rb', line 25

def info(s)
  puts s.white
end

#infov(*args) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/eac_ruby_utils/console/speaker.rb', line 33

def infov(*args)
  r = []
  args.each_with_index do |v, i|
    if i.even?
      r << "#{v}: ".cyan
    else
      r.last << v.to_s
    end
  end
  puts r.join(', ')
end

#out(s = '') ⇒ Object



9
10
11
# File 'lib/eac_ruby_utils/console/speaker.rb', line 9

def out(s = '')
  STDOUT.write(s)
end

#puts(s = '') ⇒ Object



5
6
7
# File 'lib/eac_ruby_utils/console/speaker.rb', line 5

def puts(s = '')
  STDERR.puts(s)
end

#success(s) ⇒ Object



45
46
47
# File 'lib/eac_ruby_utils/console/speaker.rb', line 45

def success(s)
  puts s.green
end

#title(s) ⇒ Object



18
19
20
21
22
23
# File 'lib/eac_ruby_utils/console/speaker.rb', line 18

def title(s)
  puts(('-' * (8 + s.length)).green)
  puts("--- #{s} ---".green)
  puts(('-' * (8 + s.length)).green)
  puts
end

#warn(s) ⇒ Object



29
30
31
# File 'lib/eac_ruby_utils/console/speaker.rb', line 29

def warn(s)
  puts s.yellow
end