Sha256: a1924a04dd4e81998f30e21d53ec59afe75af9d9a7be69dec044c9954587a2e6
Contents?: true
Size: 876 Bytes
Versions: 1
Compression:
Stored size: 876 Bytes
Contents
module Katagen module Generators # Colorization for puts, no need for another gem # TODO: should I move this into a small gem? module Logging COLOR_CODES = { red: 31, green: 32, yellow: 33, blue: 34, pink: 35, light_blue: 36 } def info(message) puts "#{colorize("info", :blue)} #{message}" end def success(message) puts "#{colorize("success", :green)} #{message}" end def warning(message) puts "#{colorize("warning", :yellow)} #{message}" end private # :reek:UtilityFunction # Colorize string with provided code. Defaults to none(0) # NOTE: reek should not complain about this in a module IMO def colorize(message, color) "\e[#{COLOR_CODES[color] || 0}m#{message}\e[0m" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
katagen-1.0.1 | lib/katagen/generators/logging.rb |