boss-protocol 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/boss-protocol.gemspec +1 -1
- data/lib/boss-protocol/version.rb +1 -1
- data/lib/boss-protocol.rb +9 -5
- data/spec/boss_spec.rb +5 -5
- metadata +2 -18
data/Gemfile
CHANGED
data/boss-protocol.gemspec
CHANGED
data/lib/boss-protocol.rb
CHANGED
@@ -3,7 +3,6 @@ require "boss-protocol/version"
|
|
3
3
|
# Encoding: utf-8
|
4
4
|
require 'stringio'
|
5
5
|
require 'zlib'
|
6
|
-
require 'bzip2'
|
7
6
|
|
8
7
|
# Copyright (c) 2008-2012 by sergeych (real.sergeych@gmail.com)
|
9
8
|
#
|
@@ -34,6 +33,9 @@ require 'bzip2'
|
|
34
33
|
##
|
35
34
|
# Boss protocol version 1.2 basic implementation
|
36
35
|
#
|
36
|
+
# Attn! We removed Bzip2 compression for the sake of compatibility. We may add it back when situation
|
37
|
+
# with bz2 implementations on various platforms will be eased
|
38
|
+
#
|
37
39
|
# 1.2 version adds support for booelans and removes support for python __reduce__ - based objects
|
38
40
|
# as absolutely non portable. It also introduces
|
39
41
|
#
|
@@ -123,8 +125,10 @@ module Boss
|
|
123
125
|
data = Zlib::Deflate.new.deflate(data, Zlib::FINISH)
|
124
126
|
1
|
125
127
|
else
|
126
|
-
data =
|
127
|
-
|
128
|
+
data = Zlib::Deflate.new.deflate(data, Zlib::FINISH)
|
129
|
+
1
|
130
|
+
#data = Bzip2.compress data
|
131
|
+
#2
|
128
132
|
end
|
129
133
|
whdr type, data.length
|
130
134
|
wbin data
|
@@ -339,8 +343,8 @@ module Boss
|
|
339
343
|
Boss.load data
|
340
344
|
when 1
|
341
345
|
Boss.load Zlib::Inflate.new(Zlib::MAX_WBITS).inflate(data)
|
342
|
-
when 2
|
343
|
-
|
346
|
+
#when 2
|
347
|
+
# Boss.load Bzip2.uncompress data
|
344
348
|
else
|
345
349
|
raise UnknownTypeException, "type #{type}"
|
346
350
|
end
|
data/spec/boss_spec.rb
CHANGED
@@ -116,11 +116,11 @@ describe 'Boss' do
|
|
116
116
|
x1.length.should <= (data.length/10)
|
117
117
|
|
118
118
|
# hevay compression on big data
|
119
|
-
data = JSON.parse(Zlib::Inflate.new(Zlib::MAX_WBITS).inflate(Base64::decode64(CompressedTestJson)))
|
120
|
-
round_check data
|
121
|
-
x2 = Boss.dump_compressed(data)
|
122
|
-
Boss.load(x2).should == data
|
123
|
-
x2.length.should < 13700
|
119
|
+
#data = JSON.parse(Zlib::Inflate.new(Zlib::MAX_WBITS).inflate(Base64::decode64(CompressedTestJson)))
|
120
|
+
#round_check data
|
121
|
+
#x2 = Boss.dump_compressed(data)
|
122
|
+
#Boss.load(x2).should == data
|
123
|
+
#x2.length.should < 13700
|
124
124
|
end
|
125
125
|
|
126
126
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boss-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: bzip2-ruby
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
14
|
- !ruby/object:Gem::Dependency
|
31
15
|
name: rspec
|
32
16
|
requirement: !ruby/object:Gem::Requirement
|