module Confgit::WithColor

Constants

ESC_CODES

Public Instance Methods

set_color(*colors) click to toggle source

エスケープシーケンスをセットする

# File lib/confgit/with_color.rb, line 36
def set_color(*colors)
        colors.each { |color|
                print "\e[", ESC_CODES[color], "m"
        }
end
with_color(*colors) { || ... } click to toggle source

カラー表示する

# File lib/confgit/with_color.rb, line 43
def with_color(*colors)
        begin
                set_color(*colors)
                yield
        ensure
                set_color(0)
        end
end