Module: Dye

Extended by:
Dye
Included in:
Dye
Defined in:
lib/dye.rb

Defined Under Namespace

Classes: UnknownSgrCode

Constant Summary collapse

VERSION =
File.read(File.expand_path('../../VERSION', __FILE__)).strip
BASIC_SGR =

Select Graphic Rendition

{
  :clear     => 0,
  :bold      => 1,
  :underline => 4,
  :blinking  => 5,
  :reversed  => 7,

  :black     => 30,
  :red       => 31,
  :green     => 32,
  :yellow    => 33,
  :blue      => 34,
  :magenta   => 35,
  :cyan      => 36,
  :white     => 37,

  :onblack   => 40,
  :onred     => 41,
  :ongreen   => 42,
  :onyellow  => 43,
  :onblue    => 44,
  :onmagenta => 45,
  :oncyan    => 46,
  :onwhite   => 47
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#colorObject Also known as: color?

Returns the value of attribute color.



52
53
54
# File 'lib/dye.rb', line 52

def color
  @color
end

#strict_ansiObject

Returns the value of attribute strict_ansi.



56
57
58
# File 'lib/dye.rb', line 56

def strict_ansi
  @strict_ansi
end

Instance Method Details

#dye(*args) ⇒ Object



58
59
60
# File 'lib/dye.rb', line 58

def dye(*args)
  apply_styles( {}, *args )
end

#strip_ansi(string) ⇒ Object



62
63
64
# File 'lib/dye.rb', line 62

def strip_ansi(string)
  string.gsub(/\e\[[\d;]+m/, '')
end