super_recursive_open_struct 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/lib/super_recursive_open_struct.rb +5 -0
- data/spec/lib/super_recursive_open_struct_spec.rb +7 -0
- data/super_recursive_open_struct.gemspec +2 -1
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f72b725a955a8c5035f68becc11c5aca1f87427
|
4
|
+
data.tar.gz: a4f844945f7152bb33d9bdca989e13140af68101
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88def8fde6e0de1eeda4b1d1644617383f8749f47d6a838ba5c5de2edd48dfcc51daba77f86d7aa8f121a9130dbccdd3a850704c121ade14262f743e7f6e9fd1
|
7
|
+
data.tar.gz: 1bca4351f172bb421e303409e5e8e384f62427ebddb737e39a28c5602982b9810449592570f1b91aec24b18abca8ceb2cf89790a47d0fc38dfc69376ef6a2c77
|
data/.travis.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "recursive_open_struct"
|
2
|
+
require "active_support/json/encoding"
|
2
3
|
|
3
4
|
class SuperRecursiveOpenStruct
|
4
5
|
def initialize(hash, args = {})
|
@@ -25,6 +26,10 @@ class SuperRecursiveOpenStruct
|
|
25
26
|
@target.respond_to?(method, include_private)
|
26
27
|
end
|
27
28
|
|
29
|
+
def to_json
|
30
|
+
ActiveSupport::JSON.encode @target
|
31
|
+
end
|
32
|
+
|
28
33
|
alias_method :to_s, def inspect
|
29
34
|
contents = @target.inspect.gsub(/\A#<RecursiveOpenStruct (.+)>\Z/, "\\1")
|
30
35
|
"#<SuperRecursiveOpenStruct:0x#{__id__.to_s(16)} #{contents}>".freeze
|
@@ -30,6 +30,13 @@ describe SuperRecursiveOpenStruct do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
describe "#to_json" do
|
34
|
+
it "delegates to the target object" do
|
35
|
+
expect(SuperRecursiveOpenStruct.new({a: 1}).to_json).to eq '{"a":1}'
|
36
|
+
expect(SuperRecursiveOpenStruct.new([{a: 'A'}, {b: 0.1}]).to_json).to eq '[{"a":"A"},{"b":0.1}]'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
33
40
|
describe "#respond_to?" do
|
34
41
|
it "is implemented properly with #respond_to_missing?" do
|
35
42
|
sros = SuperRecursiveOpenStruct.new(a: 1)
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "super_recursive_open_struct"
|
7
|
-
spec.version = "1.0.
|
7
|
+
spec.version = "1.0.2"
|
8
8
|
spec.authors = ["Cédric Félizard"]
|
9
9
|
spec.email = ["cedric@felizard.fr"]
|
10
10
|
spec.summary = %q{Like recursive-open-struct but slightly different}
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_dependency "recursive-open-struct", ">= 0.5.0"
|
21
|
+
spec.add_dependency "activesupport", ">= 3.2", "< 5"
|
21
22
|
|
22
23
|
spec.add_development_dependency "bundler", ">= 1.6"
|
23
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: super_recursive_open_struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cédric Félizard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: recursive-open-struct
|
@@ -24,6 +24,26 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.5.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.2'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '5'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '3.2'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '5'
|
27
47
|
- !ruby/object:Gem::Dependency
|
28
48
|
name: bundler
|
29
49
|
requirement: !ruby/object:Gem::Requirement
|