simple-hash 1.0.0 → 1.1.0

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
  SHA256:
3
- metadata.gz: 86c14cd18a17ad8363b701cbdeb19b67fa397a89261ace9efbfb259191ade56f
4
- data.tar.gz: 88cae9a242fe2688fd637df91a6f90e455cb5c12d5106e72c9529530ca38c0d0
3
+ metadata.gz: a0991c75aeba29f8c71c7a4b2c895a008398b16bb1a3c4d7f2429cf060706753
4
+ data.tar.gz: a1caec33168555c116dc2686173d3d93c611f92d8c5bcdad6919e13438cab969
5
5
  SHA512:
6
- metadata.gz: 35fcc9911bdbe6fd66d454488ff2e0cec18e4df5f0cb891a851223178ab7692722ab87d9a64134b261c4761320a62da5ad037846725738d3e76d4cd1b8b7e1a1
7
- data.tar.gz: 7786b3ced8331dae799a3713ae790a1e313b90369621383ae09f97ef5df9792d59fa37b9b1cf980d65a334fcb186d54ac5b908e7d5135f1d31253c11380dbb85
6
+ metadata.gz: 012752f044e65f89834551176482d63e89a338f3699c384e60079498a9e4fd1fccf263d7d1c684d177b52d3d8a8a2f17d96d853da9265fcbdf870e029799b098
7
+ data.tar.gz: 6d1078bdb7ce9cbf11139358e1cfa88a6ab7a930e11feb86d4fc4e23b727ad0c501b1734b4b59bc35a05f0f1d54ba28b6372375d8bc86f2029e9308b1909156e
data/lib/simple/hash.rb CHANGED
@@ -4,7 +4,7 @@ module Simple
4
4
  end
5
5
 
6
6
  class Simple::Hash < Simple::HashWithIndifferentAccess
7
- VERSION = "1.0.0"
7
+ VERSION = "1.1.0"
8
8
 
9
9
  def method_missing(method_name, *args, &block)
10
10
  if keys.map(&:to_s).include?(method_name.to_s) && args.empty? && block.nil?
@@ -0,0 +1,11 @@
1
+ class Simple::HashSerializer
2
+ def self.dump(simple_hash)
3
+ return if simple_hash.nil?
4
+ simple_hash.to_h
5
+ end
6
+
7
+ def self.load(hash)
8
+ return if hash.nil?
9
+ Simple::Hash.new(hash)
10
+ end
11
+ end
@@ -5,6 +5,8 @@ require "active_support/core_ext/hash/except"
5
5
  module Simple
6
6
  end
7
7
 
8
+ # same as ActiveSupport::HashWithIndifferentAccess except it does deep value conversion
9
+ # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/hash_with_indifferent_access.rb
8
10
  class Simple::HashWithIndifferentAccess < Hash
9
11
  def extractable_options?
10
12
  true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - localhostdotdev
@@ -38,6 +38,7 @@ files:
38
38
  - Rakefile
39
39
  - bin/console
40
40
  - lib/simple/hash.rb
41
+ - lib/simple/hash_serializer.rb
41
42
  - lib/simple/hash_with_indifferent_access.rb
42
43
  - simple-hash.gemspec
43
44
  - test/simple/hash_test.rb