Sha256: 6cbfdc7327042706309729e59878817cab01eb6da62e30e204801fecb8c82710
Contents?: true
Size: 666 Bytes
Versions: 32
Compression:
Stored size: 666 Bytes
Contents
require 'term/ansicolor' module PactBroker module Client class ColorizeNotices def self.call(notices) notices.collect do | notice | colorized_message(notice) end end def self.colorized_message(notice) color = color_for_type(notice.type) if color ::Term::ANSIColor.color(color, notice.text || '') else notice.text end end def self.color_for_type(type) case type when "warning", "prompt" then "yellow" when "error", "danger" then :red when "success" then :green else nil end end end end end
Version data entries
32 entries across 32 versions & 1 rubygems