em-skkserv 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/example/socialskk.rb +2 -2
- data/example/yuiskk.rb +2 -2
- data/lib/em-skkserv/server.rb +8 -0
- data/lib/em-skkserv/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25bac2b1ff19d671aaec8c8896e7cd12da868d31
|
4
|
+
data.tar.gz: e875c444a7d94a9bf183c0dde41dbf4dfa011eee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52a44571f3b4ff2121996b2a074acd338238610a266860c08234e473808000bc242c4cb1dc66ef745293914701456ddcac82abca1868038fc7c88dcdcece465a
|
7
|
+
data.tar.gz: 37964e829479a9145514e3256ac173d69f77d54327761a3110632058a2153433e0287962f57520924ab7040f5f2863e598b9ba7530c3dea37cbdbf7012d271ac
|
data/README.md
CHANGED
@@ -24,9 +24,9 @@ require 'em-skkserv'
|
|
24
24
|
class YuiSKK < EM::SKKServ::Server
|
25
25
|
def on_request(kana)
|
26
26
|
if kana == 'ゆい'
|
27
|
-
|
27
|
+
found ['ゆい(*-v・)ゆい']
|
28
28
|
else
|
29
|
-
|
29
|
+
not_found
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
data/example/socialskk.rb
CHANGED
@@ -11,9 +11,9 @@ class SocialSKK < EM::SKKServ::Server
|
|
11
11
|
data = open("http://www.social-ime.com/api/?string=#{URI.escape(kana)}").read
|
12
12
|
kanji = data.split "\t"
|
13
13
|
if kanji.size > 0
|
14
|
-
|
14
|
+
found kanji, 'EUC-JP'
|
15
15
|
else
|
16
|
-
|
16
|
+
not_found
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/example/yuiskk.rb
CHANGED
@@ -8,9 +8,9 @@ require 'em-skkserv'
|
|
8
8
|
class YuiSKK < EM::SKKServ::Server
|
9
9
|
def on_request(kana)
|
10
10
|
if kana == 'ゆい'
|
11
|
-
|
11
|
+
found ['ゆい(*-v・)ゆい']
|
12
12
|
else
|
13
|
-
|
13
|
+
not_found
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/em-skkserv/server.rb
CHANGED
@@ -12,6 +12,14 @@ module EventMachine
|
|
12
12
|
close_connection_after_writing
|
13
13
|
end
|
14
14
|
|
15
|
+
def found(kanji, encoding = 'UTF-8')
|
16
|
+
send_data ServerMessage.new(:found, :kanji => kanji, :encoding => encoding).to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
def not_found
|
20
|
+
send_data ServerMessage.new(:not_found).to_s
|
21
|
+
end
|
22
|
+
|
15
23
|
def on_close
|
16
24
|
end
|
17
25
|
|
data/lib/em-skkserv/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-skkserv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shunirr
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.0.3
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: EventMachine based SKKServ
|