rubyfox-sfsobject 0.2.2-java → 0.3.0-java
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.
@@ -13,6 +13,7 @@ module Rubyfox
|
|
13
13
|
Fixnum => :putInt,
|
14
14
|
Float => :putDouble,
|
15
15
|
Hash => proc { |o, k, v| o.putSFSObject(k, to_sfs(v)) },
|
16
|
+
Java::SFSObject => :putSFSObject,
|
16
17
|
[String] => :putUtfStringArray,
|
17
18
|
[TrueClass] => :putBoolArray,
|
18
19
|
[FalseClass] => :putBoolArray,
|
@@ -48,8 +49,8 @@ module Rubyfox
|
|
48
49
|
}
|
49
50
|
|
50
51
|
# hash -> object
|
51
|
-
def to_sfs(hash={}
|
52
|
-
object = Java::SFSObject.
|
52
|
+
def to_sfs(hash={})
|
53
|
+
object = Java::SFSObject.new
|
53
54
|
hash.each do |key, value|
|
54
55
|
wrap_value!(object, key, value)
|
55
56
|
end
|
data/test/benchmark/perf.rb
CHANGED
@@ -67,6 +67,10 @@ Benchmark.ips do |x|
|
|
67
67
|
empty.to_sfs
|
68
68
|
end
|
69
69
|
|
70
|
+
x.report("empty: hash -[] sfs") do
|
71
|
+
Rubyfox::SFSObject[empty]
|
72
|
+
end
|
73
|
+
|
70
74
|
x.report("empty: json -> sfs") do
|
71
75
|
Rubyfox::SFSObject.from_json(emptyjson)
|
72
76
|
end
|
@@ -83,6 +87,10 @@ Benchmark.ips do |x|
|
|
83
87
|
short.to_sfs
|
84
88
|
end
|
85
89
|
|
90
|
+
x.report("short: hash -[] sfs") do
|
91
|
+
Rubyfox::SFSObject[short]
|
92
|
+
end
|
93
|
+
|
86
94
|
x.report("short: json -> sfs") do
|
87
95
|
Rubyfox::SFSObject.from_json(shortjson)
|
88
96
|
end
|
@@ -99,6 +107,10 @@ Benchmark.ips do |x|
|
|
99
107
|
long.to_sfs
|
100
108
|
end
|
101
109
|
|
110
|
+
x.report("long: hash -[] sfs") do
|
111
|
+
Rubyfox::SFSObject[long]
|
112
|
+
end
|
113
|
+
|
102
114
|
x.report("long: json -> sfs") do
|
103
115
|
Rubyfox::SFSObject.from_json(longjson)
|
104
116
|
end
|
@@ -53,6 +53,10 @@ class RubyfoxSFSObjectBulkTest < RubyfoxCase
|
|
53
53
|
assert_conversion :sub => { :key => "value" }
|
54
54
|
assert_conversion :sub => { :deep => { :key => "value" } }
|
55
55
|
end
|
56
|
+
|
57
|
+
test "sfsobject" do
|
58
|
+
assert_conversion({ :sfsobject => Rubyfox::SFSObject.new }, { :sfsobject => {} })
|
59
|
+
end
|
56
60
|
end
|
57
61
|
|
58
62
|
context "array" do
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: rubyfox-sfsobject
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.3.0
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Peter Suschlik
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|