module Pork::Color
Public Instance Methods
msg_errored()
click to toggle source
Calls superclass method
# File lib/pork/more/color.rb, line 6 def msg_errored; red(super); end
msg_failed()
click to toggle source
Calls superclass method
# File lib/pork/more/color.rb, line 5 def msg_failed ; magenta(super); end
msg_skip()
click to toggle source
Calls superclass method
# File lib/pork/more/color.rb, line 4 def msg_skip ; yellow(super); end
Private Instance Methods
backtrace(*_)
click to toggle source
Calls superclass method
# File lib/pork/more/color.rb, line 55 def backtrace *_ super.map do |b| path, msgs = b.split(':', 2) dir , file = ::File.split(path) msg = msgs.sub(/(\d+):/){red($1)+':'}.sub(/`.+?'/){green($&)} "#{dir+'/'}#{yellow(file)}:#{msg}" end end
bad(text)
click to toggle source
# File lib/pork/more/color.rb, line 47 def bad text red(text) end
black(text;)
click to toggle source
# File lib/pork/more/color.rb, line 72 def black text; color( 30 , text); end
blue(text;)
click to toggle source
# File lib/pork/more/color.rb, line 76 def blue text; color( 34 , text); end
color(rgb, text)
click to toggle source
# File lib/pork/more/color.rb, line 81 def color rgb, text "\e[#{rgb}m#{text}\e[0m" end
command(name, seed)
click to toggle source
Calls superclass method
# File lib/pork/more/color.rb, line 9 def command name, seed gray(super) end
cyan(text;)
click to toggle source
# File lib/pork/more/color.rb, line 78 def cyan text; color( 36 , text); end
gray(text;)
click to toggle source
# File lib/pork/more/color.rb, line 71 def gray text; color('1;30', text); end
green(text;)
click to toggle source
# File lib/pork/more/color.rb, line 74 def green text; color( 32 , text); end
highlight_line(line)
click to toggle source
# File lib/pork/more/color.rb, line 21 def highlight_line line "#{color(41, super.chomp)}\n" end
loadings(values)
click to toggle source
# File lib/pork/more/color.rb, line 35 def loadings values with_colors(values, %w[green cyan blue]) end
magenta(text;)
click to toggle source
# File lib/pork/more/color.rb, line 77 def magenta text; color( 35 , text); end
numbers(values)
click to toggle source
# File lib/pork/more/color.rb, line 25 def numbers values values.zip(%w[green green magenta red yellow]).map do |(num, col)| if num == 0 num else send(col, num) end end end
ok(text)
click to toggle source
# File lib/pork/more/color.rb, line 43 def ok text green(text) end
red(text;)
click to toggle source
# File lib/pork/more/color.rb, line 73 def red text; color( 31 , text); end
show_exception(err)
click to toggle source
Calls superclass method
# File lib/pork/more/color.rb, line 17 def show_exception err magenta(super) end
show_message(msg)
click to toggle source
Calls superclass method
# File lib/pork/more/color.rb, line 13 def show_message msg blue(super) end
time(text)
click to toggle source
# File lib/pork/more/color.rb, line 51 def time text cyan(text) end
velocity(values)
click to toggle source
# File lib/pork/more/color.rb, line 39 def velocity values with_colors(values, %w[cyan blue blue]) end
white(text;)
click to toggle source
# File lib/pork/more/color.rb, line 79 def white text; color( 37 , text); end
with_colors(values, colors)
click to toggle source
# File lib/pork/more/color.rb, line 65 def with_colors values, colors values.zip(colors).map do |(str, col)| send(col, str) end end
yellow(text;)
click to toggle source
# File lib/pork/more/color.rb, line 75 def yellow text; color( 33 , text); end