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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd5e8eb076bada0f59a94d5d68c879fdcca3ed36
4
- data.tar.gz: 86b5346cf9bedc103e0e67abb6b45d116ed501eb
3
+ metadata.gz: 25bac2b1ff19d671aaec8c8896e7cd12da868d31
4
+ data.tar.gz: e875c444a7d94a9bf183c0dde41dbf4dfa011eee
5
5
  SHA512:
6
- metadata.gz: e1ad61dc7f23630e577cc734b99f32aa238e0396a319643e182cfcb994e0583aa1ca7b5faee363ac4f2bf1e686f232d692413dcce562acfa52e12ed0d760fb66
7
- data.tar.gz: f2e7c809d1ed5a9e54de62d1141d8e7a99f13138adab50d05a837b2fae2aeada5a4d618272280a160bf75e70ba6f9c6ff91643de8abac9b61059fbe62178d422
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
- send_data EM::SKKServ::ServerMessage.new :found, :kanji => ['']
27
+ found ['ゆい(*-v・)ゆい']
28
28
  else
29
- send_data EM::SKKServ::ServerMessage.new :not_found
29
+ not_found
30
30
  end
31
31
  end
32
32
  end
@@ -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
- send_data EM::SKKServ::ServerMessage.new :found, :kanji => kanji, :encoding => 'EUC-JP'
14
+ found kanji, 'EUC-JP'
15
15
  else
16
- send_data EM::SKKServ::ServerMessage.new :not_found
16
+ not_found
17
17
  end
18
18
  end
19
19
  end
@@ -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
- send_data EM::SKKServ::ServerMessage.new :found, :kanji => ['']
11
+ found ['ゆい(*-v・)ゆい']
12
12
  else
13
- send_data EM::SKKServ::ServerMessage.new :not_found
13
+ not_found
14
14
  end
15
15
  end
16
16
  end
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  module SKKServ
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
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.1
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.1.9
95
+ rubygems_version: 2.0.3
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: EventMachine based SKKServ