module Dapp::Dapp::Logging::Paint
Constants
- FORMAT
Public Class Methods
included(base)
click to toggle source
# File lib/dapp/dapp/logging/paint.rb, line 38 def included(base) base.extend(self) end
initialize(mode)
click to toggle source
# File lib/dapp/dapp/logging/paint.rb, line 14 def self.initialize(mode) ::Paint.mode = case mode when 'auto' then (ENV['TRAVIS'] || ENV['GITLAB_CI'] || STDOUT.tty?) ? 8 : 0 when 'on' then 8 when 'off' then 0 else raise end end
Public Instance Methods
paint_string(object, style_name)
click to toggle source
# File lib/dapp/dapp/logging/paint.rb, line 29 def paint_string(object, style_name) ::Paint[unpaint(object.to_s), *paint_style(style_name)] end
paint_style(name)
click to toggle source
# File lib/dapp/dapp/logging/paint.rb, line 23 def paint_style(name) FORMAT[name].tap do |format| raise if format.nil? end end
unpaint(str)
click to toggle source
# File lib/dapp/dapp/logging/paint.rb, line 33 def unpaint(str) ::Paint.unpaint(str) end