kyototycoon 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Changes.md +5 -0
- data/MIT-LICENSE +1 -1
- data/kyototycoon.gemspec +2 -2
- data/lib/kyototycoon/tsvrpc/skinny.rb +8 -1
- data/lib/kyototycoon/tsvrpc.rb +19 -0
- data/lib/kyototycoon.rb +1 -1
- metadata +3 -3
data/Changes.md
CHANGED
data/MIT-LICENSE
CHANGED
data/kyototycoon.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{kyototycoon}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["uu59"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-01-03}
|
13
13
|
s.description = %q{KyotoTycoon client for Ruby}
|
14
14
|
s.email = %q{a@tt25.org}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -22,18 +22,25 @@ class KyotoTycoon
|
|
22
22
|
status = first_line[9, 3]
|
23
23
|
bodylen = 0
|
24
24
|
body = ""
|
25
|
+
colenc = nil
|
25
26
|
loop do
|
26
27
|
line = @sock.gets
|
28
|
+
if line['Content-Type'] && line['colenc=']
|
29
|
+
colenc = line.match(/colenc=([A-Z])/).to_a[1]
|
30
|
+
next
|
31
|
+
end
|
32
|
+
|
27
33
|
if line['Content-Length']
|
28
34
|
bodylen = line.match(/[0-9]+/)[0].to_i
|
29
35
|
next
|
30
36
|
end
|
37
|
+
|
31
38
|
if line == "\r\n"
|
32
39
|
break
|
33
40
|
end
|
34
41
|
end
|
35
42
|
body = @sock.read(bodylen)
|
36
|
-
[status.to_i, body]
|
43
|
+
[status.to_i, Tsvrpc.decode_responce_body(body, colenc)]
|
37
44
|
end
|
38
45
|
|
39
46
|
def start
|
data/lib/kyototycoon/tsvrpc.rb
CHANGED
@@ -35,5 +35,24 @@ class KyotoTycoon
|
|
35
35
|
end
|
36
36
|
query
|
37
37
|
end
|
38
|
+
|
39
|
+
def self.decode_responce_body(body, colenc)
|
40
|
+
case colenc
|
41
|
+
when "B"
|
42
|
+
body.split("\n").map{|row|
|
43
|
+
row.split("\t").map{|col| Base64.decode64(col)}.join("\t")
|
44
|
+
}.join("\n")
|
45
|
+
when "U"
|
46
|
+
body.split("\n").map{|row|
|
47
|
+
row.split("\t").map{|col|
|
48
|
+
CGI.unescape(col)
|
49
|
+
}.join("\t")
|
50
|
+
}.join("\n")
|
51
|
+
when nil
|
52
|
+
body
|
53
|
+
else
|
54
|
+
raise "Unknown colenc(response) '#{colenc}'"
|
55
|
+
end
|
56
|
+
end
|
38
57
|
end
|
39
58
|
end
|
data/lib/kyototycoon.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 2
|
9
|
+
version: 0.5.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- uu59
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-01-03 00:00:00 +09:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|