module DogWatch::Model::Mixin::Colorize
Provides a colorize() mixin that handles shell output coloring
Public Instance Methods
colorize(param, options = {})
click to toggle source
@param [Symbol] param @param [Hash] options @return [Symbol]
# File lib/dogwatch/model/mixin/colorize.rb, line 11 def colorize(param, options = {}) define_method(:color) do case instance_variable_get("@#{ param }") when *options.fetch(:white, [:status]) then :white when *options.fetch(:cyan, [:debug, :trace]) then :cyan when *options.fetch(:green, [:info, :success, :create]) then :green when *options.fetch(:yellow, [:warn, :update]) then :yellow when *options.fetch(:red, [:error, :fail, :delete]) then :red else options.fetch(:default, :green) end end end