boss-protocol 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +2 -0
- data/boss-protocol.gemspec +1 -1
- data/lib/boss-protocol.rb +2 -2
- data/lib/boss-protocol/version.rb +1 -1
- data/spec/boss_spec.rb +33 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88325e367e81c6d045667b628bd2f048eb7309bb
|
4
|
+
data.tar.gz: 08b1938498936324561d7d68b4f3acb58c354f6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a3a36cfc30b669be43b47788da11e934a82b21890d1c2a24eb227a6fc9fdd695189a1cb6811dc45af5bd066d1448781a41cb7278d4c12cb034f8198df978fde
|
7
|
+
data.tar.gz: 8e7b80832a549cfc8ef618c186af7a023ccc6b4ab738b9e0f0d0d63075df6aac19052d345d71aa99f3096bd5173d621592a5a5ead54ac1c04c61c52ce8741d45
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/boss-protocol.gemspec
CHANGED
data/lib/boss-protocol.rb
CHANGED
@@ -36,7 +36,7 @@ require 'zlib'
|
|
36
36
|
# Attn! We removed Bzip2 compression for the sake of compatibility. We may add it back when situation
|
37
37
|
# with bz2 implementations on various platforms will be eased
|
38
38
|
#
|
39
|
-
# 1.3 Stream mode added
|
39
|
+
# 1.3.1 Stream mode added and fixed
|
40
40
|
#
|
41
41
|
# 1.2 version adds support for booelans and removes support for python __reduce__ - based objects
|
42
42
|
# as absolutely non portable. It also introduces
|
@@ -240,7 +240,7 @@ module Boss
|
|
240
240
|
whdr TYPE_CREF, n
|
241
241
|
false
|
242
242
|
else
|
243
|
-
# Check stream mode
|
243
|
+
# Check stream mode, bin and strings only
|
244
244
|
if @max_string_size
|
245
245
|
if obj.is_a?(String) && obj.length <= @max_string_size
|
246
246
|
if @cache.length > @max_cache_entries
|
data/spec/boss_spec.rb
CHANGED
@@ -114,12 +114,12 @@ describe 'Boss' do
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
h
|
117
|
+
h = MyHash.new
|
118
118
|
h[:one] = 1
|
119
119
|
h[:two] = 2
|
120
120
|
round_check h
|
121
121
|
|
122
|
-
a
|
122
|
+
a = MyArray.new
|
123
123
|
a["0"] = :zero
|
124
124
|
a["1"] = :one
|
125
125
|
round_check a
|
@@ -148,7 +148,8 @@ describe 'Boss' do
|
|
148
148
|
end
|
149
149
|
|
150
150
|
it 'should raise proper error' do
|
151
|
-
class MyObject;
|
151
|
+
class MyObject;
|
152
|
+
end
|
152
153
|
-> { Boss.dump MyObject.new }.should raise_error(Boss::NotSupportedException)
|
153
154
|
end
|
154
155
|
|
@@ -172,6 +173,35 @@ describe 'Boss' do
|
|
172
173
|
(4..6).each { |n| inp.get.should == "test#{n}" }
|
173
174
|
(4..6).each { |n| inp.get.should == "test#{n}" }
|
174
175
|
inp.get.should == "test7"
|
176
|
+
|
177
|
+
#src2 = "gRhQe1N0cmluZyB0b28gbG9uZ3tTdHJpbmcgdG9vIGxvbmd7U3RyaW5nIHRvbyBsb25nK3Rlc3QxK3Rlc3QyK3Rlc3QzK3Rlc3Q0K3Rlc3Q1K3Rlc3Q2DRUdDRUdK3Rlc3Q3"
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'should work fine with big stream mode' do
|
181
|
+
out = Boss::Formatter.new
|
182
|
+
out.stream_mode 7, 500
|
183
|
+
src = 4096.times.map { |n| s="Long string #{n}"; out << s; s }
|
184
|
+
inp = Boss::Parser.new out.string
|
185
|
+
src.each { |s| inp.get.should == s }
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'should parse following code' do
|
189
|
+
src = 'gcAAAcAAAbwgn0XEfzTatIn6O75xqrvA5yOMHfndd8G1SiIyOj057yZzc3Rh
|
190
|
+
cnQgY29tbWFuZDMfQ3RvU2VyaWFsACNkYXRhDzNhbnN3ZXIjcG9uZzNzZXJp
|
191
|
+
YWwAHx0IJQ8rZmlsZXMWJyNuYW1lKzRoZXJvM2lzX2RpcmEjc2l6ZbiIK210
|
192
|
+
aW1leTZGWxaFJ02LQWRyaWFubyBDZWxlbnRhbm9dYWW4iG15O0ZbFoU9CA=='
|
193
|
+
parser = Boss::Parser.new(Base64::decode64 src)
|
194
|
+
out = []
|
195
|
+
begin
|
196
|
+
loop {
|
197
|
+
out << (x=parser.get)
|
198
|
+
}
|
199
|
+
rescue EOFError
|
200
|
+
end
|
201
|
+
x=out[-1]
|
202
|
+
x['toSerial'].should == 1
|
203
|
+
x['serial'].should == 1
|
204
|
+
x['data']['files'].length.should == 2
|
175
205
|
end
|
176
206
|
|
177
207
|
def round_check(ob)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boss-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sergeych
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.14.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.14.0
|
27
27
|
description: Binary streamable bit-effective protocol to effectively store object
|
28
28
|
tree hierarchies
|
29
29
|
email:
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.1.11
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Traversable and streamable to protocol supports lists, hashes, caching, compression
|