konn-rupircd 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/rupircd/charcode.rb +58 -0
- data/rupircd.gemspec +2 -1
- metadata +2 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.2
|
@@ -0,0 +1,58 @@
|
|
1
|
+
=begin
|
2
|
+
= rupircd -- Ruby Pseudo IRC Deamon
|
3
|
+
|
4
|
+
ver 0.6 2009-08-11T23:45:52+09:00
|
5
|
+
|
6
|
+
Copyright (c) 2009 Hiromi Ishii
|
7
|
+
|
8
|
+
You can redistribute it and/or modify it under the same term as Ruby.
|
9
|
+
=end
|
10
|
+
|
11
|
+
require "nkf"
|
12
|
+
|
13
|
+
class String
|
14
|
+
Flag = {
|
15
|
+
NKF::UTF8 => "-W", NKF::SJIS => "-S",
|
16
|
+
NKF::JIS => "-J", NKF::EUC => "-E",
|
17
|
+
"Shift_JIS" => "-S", "UTF-8" => "-W",
|
18
|
+
"ISO-2022-JP" => "-J", "EUC-JP" => "-E"
|
19
|
+
}
|
20
|
+
|
21
|
+
def tojis
|
22
|
+
if RUBY_VERSION < "1.9"
|
23
|
+
flag = Flag[NKF.guess(self)]
|
24
|
+
NKF.nkf("#{flag} -j", self)
|
25
|
+
else
|
26
|
+
self.encode("ISO-2022-JP")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if RUBY_VERSION < "1.9"
|
31
|
+
def encode(code)
|
32
|
+
flag = Flag[NKF.guess self]
|
33
|
+
NKF.nkf("#{flag} #{Flag[code].downcase}", self)
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def encode!(code)
|
38
|
+
replace encode(code)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def toutf8
|
43
|
+
if RUBY_VERSION < "1.9"
|
44
|
+
flag = Flag[NKF.guess(self)]
|
45
|
+
NKF.nkf("#{flag} -w8", self)[3..-1]
|
46
|
+
else
|
47
|
+
self.encode("UTF-8")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def toutf8!
|
52
|
+
replace(toutf8)
|
53
|
+
end
|
54
|
+
|
55
|
+
def tojis!
|
56
|
+
replace(tojis)
|
57
|
+
end
|
58
|
+
end
|
data/rupircd.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rupircd}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["konn"]
|
@@ -41,6 +41,7 @@ Gem::Specification.new do |s|
|
|
41
41
|
"ircd.rb",
|
42
42
|
"lib/rupircd.rb",
|
43
43
|
"lib/rupircd/channel.rb",
|
44
|
+
"lib/rupircd/charcode.rb",
|
44
45
|
"lib/rupircd/conf.rb",
|
45
46
|
"lib/rupircd/message.rb",
|
46
47
|
"lib/rupircd/server.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konn-rupircd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- konn
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- ircd.rb
|
48
48
|
- lib/rupircd.rb
|
49
49
|
- lib/rupircd/channel.rb
|
50
|
+
- lib/rupircd/charcode.rb
|
50
51
|
- lib/rupircd/conf.rb
|
51
52
|
- lib/rupircd/message.rb
|
52
53
|
- lib/rupircd/server.rb
|