hessian2 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,7 @@ module Hessian2
27
27
  end
28
28
  write(TypeWrapper.new('X', obj), refs, chunks)
29
29
  else
30
- if obj.bytesize == obj.size
30
+ if obj.ascii_only?
31
31
  chunks << [ 'X', obj.size ].pack('an') << obj
32
32
  else
33
33
  chunks << [ 'X', obj.size, obj.unpack('U*') ].flatten.pack('anU*')
@@ -72,7 +72,7 @@ module Hessian2
72
72
  end
73
73
  write(val, refs, chunks)
74
74
  else
75
- if val.bytesize == val.size
75
+ if val.ascii_only?
76
76
  chunks << [ 'S', val.size ].pack('an') << val
77
77
  else
78
78
  chunks << [ 'S', val.size, val.unpack('U*') ].flatten.pack('anU*')
@@ -83,8 +83,8 @@ module Hessian2
83
83
  str = val.to_s
84
84
  [ 'S', str.size ].pack('an') << str # string
85
85
  when Array
86
- id = refs[val.object_id]
87
- return [ 'R', id ].pack('aN') if id
86
+ idx = refs[val.object_id]
87
+ return [ 'R', idx ].pack('aN') if idx
88
88
 
89
89
  refs[val.object_id] = refs.size
90
90
 
@@ -94,8 +94,8 @@ module Hessian2
94
94
  val.each{ |v| str << write(v, refs) }
95
95
  str << 'z' # list
96
96
  when Hash
97
- id = refs[val.object_id]
98
- return [ 'R', id ].pack('aN') if id
97
+ idx = refs[val.object_id]
98
+ return [ 'R', idx ].pack('aN') if idx
99
99
 
100
100
  refs[val.object_id] = refs.size
101
101
 
@@ -107,7 +107,7 @@ module Hessian2
107
107
  end
108
108
  str << 'z' # map
109
109
  else # covert val to hash
110
- hash = {}.tap do |h|
110
+ h = {}.tap do |h|
111
111
  val.instance_variables.each {|var| h[var.to_s.delete("@")] = val.instance_variable_get(var) }
112
112
  end
113
113
 
@@ -122,7 +122,7 @@ module Hessian2
122
122
  end
123
123
  end
124
124
 
125
- write(hash, refs, chunks, type)
125
+ write(h, refs, chunks, type)
126
126
  end
127
127
  end
128
128
 
@@ -1,3 +1,3 @@
1
1
  module Hessian2
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hessian2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: