boss-protocol 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -30,7 +30,7 @@ Supported types:
30
30
  * Boolean values (true/false)
31
31
  * UTF-8 encoded texts, any length
32
32
  * Binary data, any length
33
- * Time objects (rounded to 1s resolution)
33
+ * Time objects (date and time rounded to 1 second resolution)
34
34
  * Arrays with any number of elements
35
35
  * Hashes with any keys and values and unlimited length
36
36
  * Reference to the object that already was serialized
@@ -120,6 +120,13 @@ pipes, tcp sockets, stringIO - everything is ok.
120
120
  The protocol could be very effectively used to form higher level protocols over the
121
121
  network as it caches data on the fly and can provide links (if used with
122
122
 
123
+ ## Note about caching objects
124
+
125
+ When reconstructing object tree, cache is used for strings. As ruby language hash
126
+ mutable strings, it might cause side effects, as all ecounters of a given string
127
+ will share same object after reconstruction. For this reason, ruby implementation
128
+ freezes shared strings.
129
+
123
130
  ## Contributing
124
131
 
125
132
  1. Fork it
@@ -1,3 +1,3 @@
1
1
  module Boss
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/boss-protocol.rb CHANGED
@@ -364,7 +364,9 @@ module Boss
364
364
  value.times { dict[get] = get }
365
365
  dict
366
366
  when TYPE_CREF
367
- @cache[value]
367
+ x = @cache[value]
368
+ x.freeze if x.is_a?(String)
369
+ x
368
370
  else
369
371
  raise UnknownTypeException
370
372
  end
data/spec/boss_spec.rb CHANGED
@@ -63,6 +63,7 @@ describe 'Boss' do
63
63
 
64
64
  f.should == "oops"
65
65
  g.should == f
66
+ g.should be_frozen
66
67
  g.should be_equal(f)
67
68
  end
68
69
 
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.0
4
+ version: 0.1.1
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: 2012-12-20 00:00:00.000000000 Z
12
+ date: 2013-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bzip2-ruby
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  requirements: []
85
85
  rubyforge_project:
86
- rubygems_version: 1.8.24
86
+ rubygems_version: 1.8.25
87
87
  signing_key:
88
88
  specification_version: 3
89
89
  summary: Traversable and streamable to protocol supports lists, hashes, caching, compression