ruby-serial 1.0.0.20130705 → 1.0.1.20130709
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +1 -0
- data/ChangeLog +4 -0
- data/ReleaseInfo +1 -1
- data/lib/ruby-serial/common.rb +7 -1
- data/lib/ruby-serial/versions/1/deserializer.rb +3 -1
- data/lib/ruby-serial/versions/1/serializer.rb +7 -1
- metadata +3 -5
data/AUTHORS
CHANGED
data/ChangeLog
CHANGED
data/ReleaseInfo
CHANGED
data/lib/ruby-serial/common.rb
CHANGED
@@ -2,9 +2,15 @@ module RubySerial
|
|
2
2
|
|
3
3
|
# Find shortest strings that are unlikely to get in functional Hashes' keys
|
4
4
|
# !!! Use UTF-8 encoding as otherwise MessagePack won't be able to read data correctly
|
5
|
+
|
6
|
+
# Following are used as Hash keys. No duplicates allowed.
|
5
7
|
OBJECT_ID_REFERENCE = "\x00\xA0".force_encoding(Encoding::UTF_8)
|
6
8
|
OBJECT_CONTENT_REFERENCE = "\x00\xF1".force_encoding(Encoding::UTF_8)
|
7
9
|
OBJECT_CLASSNAME_REFERENCE = "\x00\xBB".force_encoding(Encoding::UTF_8)
|
8
|
-
|
10
|
+
|
11
|
+
# Following are used as class identifiers in Hash values.
|
12
|
+
# No duplicates allowed.
|
13
|
+
CLASS_ID_SYMBOL = "\x00\xEE".force_encoding(Encoding::UTF_8)
|
14
|
+
CLASS_ID_ENCODING = "\x00\xDD".force_encoding(Encoding::UTF_8)
|
9
15
|
|
10
16
|
end
|
@@ -48,8 +48,10 @@ module RubySerial
|
|
48
48
|
elsif (decoded_obj.is_a?(Hash))
|
49
49
|
# Check for special hashes
|
50
50
|
if (decoded_obj[OBJECT_ID_REFERENCE] == nil)
|
51
|
-
if (decoded_obj[OBJECT_CLASSNAME_REFERENCE] ==
|
51
|
+
if (decoded_obj[OBJECT_CLASSNAME_REFERENCE] == CLASS_ID_SYMBOL)
|
52
52
|
return decoded_obj[OBJECT_CONTENT_REFERENCE].to_sym
|
53
|
+
elsif (decoded_obj[OBJECT_CLASSNAME_REFERENCE] == CLASS_ID_ENCODING)
|
54
|
+
return Encoding::find(decoded_obj[OBJECT_CONTENT_REFERENCE])
|
53
55
|
elsif (decoded_obj[OBJECT_CLASSNAME_REFERENCE] == nil)
|
54
56
|
# Normal hash
|
55
57
|
hash_obj = ((container_to_fill == nil) ? {} : container_to_fill)
|
@@ -47,6 +47,7 @@ module RubySerial
|
|
47
47
|
(!obj.is_a?(Bignum)) and
|
48
48
|
(!obj.is_a?(Float)) and
|
49
49
|
(!obj.is_a?(Symbol)) and
|
50
|
+
(!obj.is_a?(Encoding)) and
|
50
51
|
(obj != nil) and
|
51
52
|
(obj != true) and
|
52
53
|
(obj != false))
|
@@ -95,9 +96,14 @@ module RubySerial
|
|
95
96
|
elsif (obj.is_a?(Symbol))
|
96
97
|
# TODO (MessagePack): Remove this if MessagePack handles Symbols one day
|
97
98
|
return {
|
98
|
-
OBJECT_CLASSNAME_REFERENCE =>
|
99
|
+
OBJECT_CLASSNAME_REFERENCE => CLASS_ID_SYMBOL,
|
99
100
|
OBJECT_CONTENT_REFERENCE => obj.to_s
|
100
101
|
}
|
102
|
+
elsif (obj.is_a?(Encoding))
|
103
|
+
return {
|
104
|
+
OBJECT_CLASSNAME_REFERENCE => CLASS_ID_ENCODING,
|
105
|
+
OBJECT_CONTENT_REFERENCE => obj.name
|
106
|
+
}
|
101
107
|
elsif (check_shared and
|
102
108
|
(@shared_objs[obj.object_id] != nil))
|
103
109
|
# This object is shared: store its object_id only
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-serial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1.20130709
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
@@ -37,9 +37,7 @@ description: ! 'Library serializing Ruby objects, optimized in many ways:
|
|
37
37
|
|
38
38
|
* Gives the ability to fine tune which attributes of your objects are to be serialized
|
39
39
|
|
40
|
-
* Keeps backward compatibility with previously serialized
|
41
|
-
block-buffered and cached read over IO objects with a String-like interface. Ideal
|
42
|
-
to parse big files as Strings, limiting memory consumption.'
|
40
|
+
* Keeps backward compatibility with previously serialized versions.'
|
43
41
|
email: muriel@x-aeon.com
|
44
42
|
executables: []
|
45
43
|
extensions: []
|