ansirc 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/ansirc.rb +21 -19
  2. metadata +1 -1
@@ -6,32 +6,34 @@
6
6
 
7
7
  class ANSIRC
8
8
  COLOR_MAP = {
9
- "\033[0m" => '',
10
- "\033[1;37m" => 0,
11
- "\033[0;30m" => 1,
12
- "\033[0;34m" => 2,
13
- "\033[0;32m" => 3,
14
- "\033[0;31m" => 4,
15
- "\033[0;33m" => 5,
16
- "\033[0;35m" => 6,
17
- "\033[0;33m" => 7,
18
- "\033[1;33m" => 8,
19
- "\033[1;32m" => 9,
20
- "\033[0;36m" => 10,
21
- "\033[1;36m" => 11,
22
- "\033[1;34m" => 12,
23
- "\033[1;31m" => 13,
24
- "\033[1;30m" => 14,
25
- "\033[0;37m" => 15
9
+ "\033[0m" => "\0xF", # reset
10
+ "\033[1;37m" => "\0030",
11
+ "\033[0;30m" => "\0031",
12
+ "\033[0;34m" => "\0032",
13
+ "\033[0;32m" => "\0033",
14
+ "\033[0;31m" => "\0034",
15
+ "\033[0;33m" => "\0035",
16
+ "\033[0;35m" => "\0036",
17
+ "\033[0;33m" => "\0037",
18
+ "\033[1;33m" => "\0038",
19
+ "\033[1;32m" => "\0039",
20
+ "\033[0;36m" => "\00310",
21
+ "\033[1;36m" => "\00311",
22
+ "\033[1;34m" => "\00312",
23
+ "\033[1;31m" => "\00313",
24
+ "\033[1;30m" => "\00314",
25
+ "\033[0;37m" => "\00315",
26
+ "\033[1m" => "\002", # bold on
27
+ "\033[22m" => "\002", # bold off
26
28
  }
27
29
 
28
30
  def self.to_irc(text)
29
- COLOR_MAP.each { |ansi, irc| text.gsub!(ansi, "#{3.chr}#{irc}") }
31
+ COLOR_MAP.each { |ansi, irc| text.gsub!(ansi, irc) }
30
32
  text
31
33
  end
32
34
 
33
35
  def self.to_ansi(text)
34
- COLOR_MAP.each { |ansi, irc| text.gsub!("#{3.chr}#{irc}", ansi) }
36
+ COLOR_MAP.each { |ansi, irc| text.gsub!(irc, ansi) }
35
37
  text
36
38
  end
37
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansirc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: