Class: StringIrc

Inherits:
Object
  • Object
show all
Defined in:
lib/string-irc.rb

Constant Summary collapse

COLOR_CODE =

u0003

"\x03"
BOLD =

u0002

"\x02"
UNDERLINE =

u001F

"\x1f"
INVERSE =

u0016

"\x16"
CLEAR =

u000F

"\x0f"
COLOR_TABLE =
{
  0  => %w(white),
  1  => %w(black),
  2  => %w(blue navy),
  3  => %w(green),
  4  => %w(red),
  5  => %w(brown maroon),
  6  => %w(purple),
  7  => %w(orange olive),
  8  => %w(yellow),
  9  => %w(light_green lime),
  10 => %w(teal a_green blue_cyan),
  11 => %w(light_cyan cyan aqua),
  12 => %w(light_blue royal),
  13 => %w(pink light_purple fuchsia),
  14 => %w(grey),
  15 => %w(light_grey silver),
}
ORIGINAL_COLOR_SCHEME =
{
  "rainbow"      => %w(red orange yellow green blue light_blue purple), # order is referred: http://ja.wikipedia.org/wiki/%E8%99%B9
  "seven_eleven" => %w(orange green red)
}
@@color_name_table =
{}

Instance Method Summary collapse

Constructor Details

#initialize(string = nil) ⇒ StringIrc

Returns a new instance of StringIrc.



34
35
36
# File 'lib/string-irc.rb', line 34

def initialize(string = nil)
  @string = string
end

Instance Method Details

#boldObject



73
74
75
# File 'lib/string-irc.rb', line 73

def bold
  add_code_l BOLD
end

#inverseObject



81
82
83
# File 'lib/string-irc.rb', line 81

def inverse
  add_code_l INVERSE
end

#stringfyObject Also known as: to_s



85
86
87
# File 'lib/string-irc.rb', line 85

def stringfy
  "#{@string}#{CLEAR}"
end

#underlineObject



77
78
79
# File 'lib/string-irc.rb', line 77

def underline
  add_code_l UNDERLINE
end