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/.gitignore +2 -0
- data/.travis.yml +5 -4
- data/AUTHORS.txt +1 -0
- data/Rakefile +5 -0
- data/lib/recursive_open_struct.rb +5 -5
- data/lib/recursive_open_struct/deep_dup.rb +1 -0
- data/lib/recursive_open_struct/version.rb +1 -1
- data/spec/recursive_open_struct/recursion_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12d07e25ed0f3cedb3b40ede9f61407ea53a9927
|
4
|
+
data.tar.gz: a485cfb540bfb5bd8c91c423e51d54178667c43d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e15e67bbc323ae60734aebe7a5f124c35ff96b22589ec295c8a6e374390ba9b869e9e34f0f1b04c5079853b950e77f0cdbb5b55933ce908f8bf66b012c23a65
|
7
|
+
data.tar.gz: 2d1466d7c584cf5d969ab5ae49ba5c79f17ef85fd86001e56ecac64e0317c92449c87b89dfc6d20ac4b7c372a6bc0eb560b8d3b44e942ba02d0810fc3f660fe8
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/AUTHORS.txt
CHANGED
@@ -7,6 +7,7 @@ Recursive-open-struct was written by these fine people:
|
|
7
7
|
* Matt Culpepper <matt@culpepper.co>
|
8
8
|
* Matthew O'Riordan <matthew.oriordan@gmail.com>
|
9
9
|
* Offirmo <offirmo.net@gmail.com>
|
10
|
+
* Pedro Sena <sena.pedro@gmail.com>
|
10
11
|
* Peter Yeremenko <peter.yeremenko@gmail.com>
|
11
12
|
* Sebastian Gaul <sebastian@mgvmedia.com>
|
12
13
|
* Thiago Guimaraes <thiagogsr@gmail.com>
|
data/Rakefile
CHANGED
@@ -116,15 +116,15 @@ class RecursiveOpenStruct < OpenStruct
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def recurse_over_array(array)
|
119
|
-
array.
|
119
|
+
array.each_with_index do |a, i|
|
120
120
|
if a.is_a? Hash
|
121
|
-
self.class.new(a, :recurse_over_arrays => true,
|
121
|
+
array[i] = self.class.new(a, :recurse_over_arrays => true,
|
122
|
+
:mutate_input_hash => true, :preserve_original_keys => @preserve_original_keys)
|
122
123
|
elsif a.is_a? Array
|
123
|
-
recurse_over_array a
|
124
|
-
else
|
125
|
-
a
|
124
|
+
array[i] = recurse_over_array a
|
126
125
|
end
|
127
126
|
end
|
127
|
+
array
|
128
128
|
end
|
129
129
|
|
130
130
|
end
|
@@ -261,6 +261,10 @@ describe RecursiveOpenStruct do
|
|
261
261
|
it "ROS's it" do
|
262
262
|
expect(subject.mystery.science[0].theatre).to eq 9000
|
263
263
|
end
|
264
|
+
|
265
|
+
specify "the changes show up in .to_h" do
|
266
|
+
expect(subject.to_h).to eq({ mystery: { science: [{theatre: 9000}]}})
|
267
|
+
end
|
264
268
|
end
|
265
269
|
|
266
270
|
context 'after appending a hash to an array' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: 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
|
- William (B.J.) Snow Orvis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|