ostruct_deep 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4587d8f5002f9fba22152b058af45eed9a07d1d5
4
- data.tar.gz: c3a245eae8ba1d5d9103b30fb4fd00e85666ed5b
3
+ metadata.gz: 20b2dff042c06561bf548cf8a79549fd23ddd139
4
+ data.tar.gz: c2c95f122d344302da92ce41cbb5ce1495dd0d1d
5
5
  SHA512:
6
- metadata.gz: 9c6c6bbbcd233fb3e9ce748dc50956596fbeb4f5df0ac923b632319a160143d935f414ec5af65976b2ef20e3f96abee9e5dc7c3bf9a4744a5fad79609fe53e0b
7
- data.tar.gz: d70e2c079eac5c72c961258fbe3f6f0597d880d06847cb556876f5d7190851f530260dd07d7905db043905c15ac29bb762708b61eda1657a52651c2123b3e968
6
+ metadata.gz: cde515672abb8649f6653ab87cbfbe1e1ce15db5c08fe838aab22cb3004965fdde1b02f5b9cfbcd39d8cf619c3c9c597d3f628fed0dd323fc04a5a064ad5b9f8
7
+ data.tar.gz: ef2de07b50dc3368bc11dd8d24f4be460c7853fdcb1327e41b9847ea773bec68b6336bca3c6711f8be4659bf9444aa116207898591d10bcd1c26f0f7ea301d7c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ostruct_deep (0.1.4)
4
+ ostruct_deep (0.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -51,16 +51,16 @@ puts person.address # -> nil
51
51
  #### <Hash obj>.to_ostruct_deep
52
52
  - return : object of OpenStructDeep
53
53
  ```ruby
54
- hash = {name: "John Smith", age: 70, pension: 300}
55
- hash.to_ostruct_deep # -> #<OpenStructDeep name="John Smith", age=70, pension=300>
54
+ hash = {name: "John Smith", age: 70, pension: 300, friends: ["Pablov", "Harry", "Peter"]}
55
+ hash.to_ostruct_deep # -> <OpenStructDeep name="John Smith", age=70, pension=300, friends=["Pablov", "Harry", "Peter"]>
56
56
  ```
57
57
 
58
58
  #### <OpenStructDeep obj>.to_h
59
59
  - return : object of hash
60
60
  ```ruby
61
- hash = {name: "John Smith", age: 70, pension: 300}
62
- osd = OpenStructDeep.new(hash) # -> <OpenStructDeep name="John Smith", age=70, pension=300>
63
- osd.to_h # -> {:name=>"John Smith", :age=>70, :pension=>300}
61
+ hash = {name: "John Smith", age: 70, pension: 300, friends: ["Pablov", "Harry", "Peter"]}
62
+ osd = OpenStructDeep.new(hash) # -> <OpenStructDeep name="John Smith", age=70, pension=300, friends=["Pablov", "Harry", "Peter"]>
63
+ osd.to_h # -> {:name=>"John Smith", :age=>70, :pension=>300, :friends=>["Pablov", "Harry", "Peter"]}
64
64
  ```
65
65
 
66
66
  ## What's new?
@@ -0,0 +1,2 @@
1
+ require 'json'
2
+
@@ -1,2 +1,3 @@
1
1
  require_relative 'ostruct_deep/open_struct_deep'
2
- require_relative 'hash/hash'
2
+ require_relative 'hash/hash'
3
+ require_relative 'json/json'
@@ -11,7 +11,7 @@ class OpenStructDeep < OpenStruct
11
11
  when Hash
12
12
  OpenStructDeep.new v
13
13
  when Array
14
- v.map { |x| OpenStructDeep.new x }
14
+ v.map { |x| x.is_a?(Hash) ? OpenStructDeep.new(x) : x }
15
15
  else
16
16
  v
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module OpenStructExtend
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ostruct_deep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Kim
@@ -70,6 +70,7 @@ files:
70
70
  - bin/console
71
71
  - bin/setup
72
72
  - lib/open_struct_extend/hash/hash.rb
73
+ - lib/open_struct_extend/json/json.rb
73
74
  - lib/open_struct_extend/ostruct_deep.rb
74
75
  - lib/open_struct_extend/ostruct_deep/open_struct_deep.rb
75
76
  - lib/open_struct_extend/version.rb