rubyfox-sfsobject 0.6.1-java → 0.7.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.
- checksums.yaml +5 -5
- data/.travis.yml +2 -3
- data/Gemfile +0 -4
- data/README.md +9 -8
- data/lib/rubyfox/sfsobject/bulk.rb +2 -0
- data/lib/rubyfox/sfsobject/version.rb +1 -1
- data/test/helper.rb +0 -5
- data/test/rubyfox/sfsobject/bulk_test.rb +32 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 951a3ae2c4685874984d864d8180e718aaafd244bb86568ad4559e98462e88f3
|
4
|
+
data.tar.gz: 440f5a23113e6b4e97293b6f918021fe8c5de6d48be8bb69e38cc18fed66e652
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80c53e96107964aa455c2524fe3f1f943481d8c593feaaa387a09f039cca807e13613d8f254c4084ac970290468c80b9c05897be7c65162478173c0ddf566884
|
7
|
+
data.tar.gz: 9270e00d175de0b25dfcba579b724d5fe823429113438ae5d424ac9fef2e2c86be5a2c2e3e77e5ee77ebe1fb98411355fdf9ca5374b37bb7811c8068043b4334
|
data/.travis.yml
CHANGED
@@ -2,11 +2,10 @@ language: ruby
|
|
2
2
|
sudo: false
|
3
3
|
cache: bundler
|
4
4
|
rvm:
|
5
|
-
- jruby-9.1.
|
6
|
-
- jruby-1.7.
|
5
|
+
- jruby-9.1.13.0
|
6
|
+
- jruby-1.7.27
|
7
7
|
env:
|
8
8
|
global:
|
9
|
-
- CODECLIMATE_REPO_TOKEN=7800b9ed7143dedbdc5e3c62021efa6944bacce3ea9e001654d7481cdabb8c07
|
10
9
|
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
11
10
|
matrix:
|
12
11
|
fast_finish: true
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,15 +2,12 @@
|
|
2
2
|
[doc]: http://rubydoc.info/github/neopoly/rubyfox-sfsobject/master/file/README.md
|
3
3
|
[gem]: https://rubygems.org/gems/rubyfox-sfsobject
|
4
4
|
[travis]: https://travis-ci.org/neopoly/rubyfox-sfsobject
|
5
|
-
[codeclimate]: https://codeclimate.com/github/neopoly/rubyfox-sfsobject
|
6
5
|
[inchpages]: https://inch-ci.org/github/neopoly/rubyfox-sfsobject
|
7
6
|
|
8
7
|
# Rubyfox::SFSObject
|
9
8
|
|
10
9
|
[][travis]
|
11
10
|
[][gem]
|
12
|
-
[][codeclimate]
|
13
|
-
[][codeclimate]
|
14
11
|
[][inchpages]
|
15
12
|
|
16
13
|
[Gem][gem] |
|
@@ -23,7 +20,7 @@ Converts between SmartFox's SFSObjects and Ruby Hashes.
|
|
23
20
|
|
24
21
|
Add this line to your application's Gemfile:
|
25
22
|
|
26
|
-
gem 'rubyfox-sfsobject'
|
23
|
+
gem 'rubyfox-sfsobject', '~> 0.7.0'
|
27
24
|
|
28
25
|
And then execute:
|
29
26
|
|
@@ -31,7 +28,7 @@ And then execute:
|
|
31
28
|
|
32
29
|
Or install it yourself as:
|
33
30
|
|
34
|
-
$ gem install rubyfox-sfsobject
|
31
|
+
$ gem install rubyfox-sfsobject -v 0.7.0
|
35
32
|
|
36
33
|
## Usage
|
37
34
|
|
@@ -88,7 +85,10 @@ sfs_object[:string] # => "value"
|
|
88
85
|
|
89
86
|
## Caveats
|
90
87
|
|
91
|
-
|
88
|
+
* All hash keys will be converted to symbols
|
89
|
+
* In "bulk mode"
|
90
|
+
* all Ruby's Float values will be converted Java's double (via `putDouble` or `putDoubleArray`)
|
91
|
+
* all Java's double values will be converted to Ruby's float (via `getFloat` or `getFloatArray`)
|
92
92
|
|
93
93
|
## TODO
|
94
94
|
|
@@ -97,8 +97,9 @@ sfs_object[:string] # => "value"
|
|
97
97
|
## Release
|
98
98
|
|
99
99
|
1. Bump `VERSION` in `lib/rubyfox/sfsobject/version.rb`
|
100
|
-
2.
|
101
|
-
3.
|
100
|
+
2. Tweak versions in `README.md`
|
101
|
+
3. Commit version bump via `git commit -am "Release X.Y.Z"`
|
102
|
+
4. Run `rake release`
|
102
103
|
|
103
104
|
## Contributing
|
104
105
|
|
@@ -41,12 +41,14 @@ module Rubyfox
|
|
41
41
|
"BOOL" => :getBool,
|
42
42
|
"INT" => :getInt,
|
43
43
|
"DOUBLE" => :getDouble,
|
44
|
+
"FLOAT" => :getFloat,
|
44
45
|
"UTF_STRING_ARRAY" => :getUtfStringArray,
|
45
46
|
"BOOL_ARRAY" => :getBoolArray,
|
46
47
|
#"INT_ARRAY" => :getIntArray,
|
47
48
|
"INT_ARRAY" => proc { |k, v| v.object.to_a },
|
48
49
|
"LONG_ARRAY" => :getLongArray,
|
49
50
|
"DOUBLE_ARRAY" => :getDoubleArray,
|
51
|
+
"FLOAT_ARRAY" => :getFloatArray,
|
50
52
|
"SFS_OBJECT" => proc { |k, v| to_hash(v.object) },
|
51
53
|
"SFS_ARRAY" => proc { |k, v| to_array(v.object) }
|
52
54
|
}
|
data/test/helper.rb
CHANGED
@@ -56,6 +56,22 @@ class RubyfoxSFSObjectBulkTest < RubyfoxCase
|
|
56
56
|
assert_conversion :float => 1.0 / 3
|
57
57
|
end
|
58
58
|
|
59
|
+
test "converts Java's double to Ruby's Float" do
|
60
|
+
object = Rubyfox::SFSObject.new
|
61
|
+
object.put_double("double", 1.0 / 3)
|
62
|
+
hash = Rubyfox::SFSObject::Bulk.to_hash(object)
|
63
|
+
|
64
|
+
assert_in_epsilon 1.0 / 3, hash.fetch(:double)
|
65
|
+
end
|
66
|
+
|
67
|
+
test "converts Java's float to Ruby's Float" do
|
68
|
+
object = Rubyfox::SFSObject.new
|
69
|
+
object.put_float("float", 1.0 / 3)
|
70
|
+
hash = Rubyfox::SFSObject::Bulk.to_hash(object)
|
71
|
+
|
72
|
+
assert_in_epsilon 1.0 / 3, hash.fetch(:float)
|
73
|
+
end
|
74
|
+
|
59
75
|
test "sub hashes" do
|
60
76
|
assert_conversion :sub => { :key => "value" }
|
61
77
|
assert_conversion :sub => { :deep => { :key => "value" } }
|
@@ -86,6 +102,22 @@ class RubyfoxSFSObjectBulkTest < RubyfoxCase
|
|
86
102
|
assert_conversion :float => [ 1.0, 1.0 / 3 ]
|
87
103
|
end
|
88
104
|
|
105
|
+
test "converts Java's double array to Ruby's Float array" do
|
106
|
+
object = Rubyfox::SFSObject.new
|
107
|
+
object.put_double_array("double_array", [1.0 / 3])
|
108
|
+
hash = Rubyfox::SFSObject::Bulk.to_hash(object)
|
109
|
+
|
110
|
+
assert_equal [1.0 / 3], hash.fetch(:double_array)
|
111
|
+
end
|
112
|
+
|
113
|
+
test "converts Java's float to Ruby's Float" do
|
114
|
+
object = Rubyfox::SFSObject.new
|
115
|
+
object.put_float_array("float_array", [1.0 / 3])
|
116
|
+
hash = Rubyfox::SFSObject::Bulk.to_hash(object)
|
117
|
+
|
118
|
+
assert_equal [1.0 / 3], hash.fetch(:float_array)
|
119
|
+
end
|
120
|
+
|
89
121
|
test "sub hashes" do
|
90
122
|
assert_conversion :sub => [{ :key => "value" }]
|
91
123
|
assert_conversion :sub => [{ :deep => [{ :key => "value" }] }]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyfox-sfsobject
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Peter Suschlik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
103
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.6.
|
104
|
+
rubygems_version: 2.6.11
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: ''
|