Class: CheckIt::StyledIO

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/checkit/styled_io.rb

Instance Method Summary collapse

Instance Method Details

#colorize(type, text) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/checkit/styled_io.rb', line 6

def colorize(type, text)
  color = case type
  when :alert, :error
    :red
  when :notice, :ok
    :green
  when :help, :warning
    :yellow
  else
    :white
  end
  ANSI.color(color) { text }
end


20
21
22
23
24
25
26
# File 'lib/checkit/styled_io.rb', line 20

def print_header(txt)
  self.puts
  self.puts '+' + '-' * 78 + '+'
  self.puts '| ' + txt.ljust(76) + ' |'
  self.puts '+' + '-' * 78 + '+'
  self.puts
end