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),
}

Instance Method Summary collapse

Constructor Details

#initialize(string = nil) ⇒ StringIrc

Returns a new instance of StringIrc.



30
31
32
# File 'lib/string-irc.rb', line 30

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

Instance Method Details

#boldObject



51
52
53
# File 'lib/string-irc.rb', line 51

def bold
  add_code_l BOLD
end

#inverseObject



59
60
61
# File 'lib/string-irc.rb', line 59

def inverse
  add_code_l INVERSE
end

#stringfyObject Also known as: to_s



63
64
65
# File 'lib/string-irc.rb', line 63

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

#underlineObject



55
56
57
# File 'lib/string-irc.rb', line 55

def underline
  add_code_l UNDERLINE
end