ruby-serial 1.0.0.20130705 → 1.0.1.20130709

Sign up to get free protection for your applications and to get access to all the features.
data/AUTHORS CHANGED
@@ -1,3 +1,4 @@
1
1
  = Muriel Salvan (muriel@x-aeon.com)
2
2
 
3
3
  * 1.0.0.20130705
4
+ * 1.0.1.20130709
data/ChangeLog CHANGED
@@ -1,5 +1,9 @@
1
1
  = Ruby-Serial Release History
2
2
 
3
+ == 1.0.1.20130709 (Beta)
4
+
5
+ * Added support for Encoding objects
6
+
3
7
  == 1.0.0.20130705 (Beta)
4
8
 
5
9
  * Initial public release.
data/ReleaseInfo CHANGED
@@ -2,7 +2,7 @@
2
2
  # This file has been generated by RubyPackager during a delivery.
3
3
  # More info about RubyPackager: http://rubypackager.sourceforge.net
4
4
  {
5
- :version => '1.0.0.20130705',
5
+ :version => '1.0.1.20130709',
6
6
  :tags => [ 'Beta' ],
7
7
  :dev_status => 'Beta'
8
8
  }
@@ -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
- SYMBOL_ID = "\x00\xEE".force_encoding(Encoding::UTF_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] == SYMBOL_ID)
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 => SYMBOL_ID,
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.0.20130705
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-05 00:00:00.000000000 Z
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 versionsRuby library giving
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: []