hash_ext 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bb99caf8aab9c57468441c32b81ca57af6f62c721f02e2de3b50e35a25f844c
4
- data.tar.gz: 954260a1450f803f93496417d5fdc27a2cae5ab55d29f177c5e64162c4e398f9
3
+ metadata.gz: cdfe491b5c140f70b6b00ad01689d4ad0a19f284247f0ee0ec8f1a0a142fefc2
4
+ data.tar.gz: 51c7366d4aadaa3425104581ee9315ccd2876769eaa672bb5f70fcf074f97143
5
5
  SHA512:
6
- metadata.gz: bc8bb6beb185f177b5be28d3391a3f07f3202cda8adfcc41241cdcbf4fb1fbc1b40a7f6773bad729ae26e54d24b477f69d1a549753e48f54a4e39624afe5cc49
7
- data.tar.gz: c083a701839254828d2d3d7dd588e62aa028421069128b58fb5c8956475e7c3001965d7a7b59c185302782b27577ecb6b1e9a4b546fc8e42892fc196cd984783
6
+ metadata.gz: dea9009fd4c2ae946c3b975c09ba208a357c6ed7abe974185260102affbd6a0e4f68910fd1dbff2378306004958aaedd4024eae4dbd50c71cb95b6be3beb1f9b
7
+ data.tar.gz: '09bc0cc742daaa6854c5e23d338e55bcbc080168586d6d9a44a390e34b98bb5c490656c90f52e793349892d8b23ad3e3e0e552218e7c88d323671fe47802a0c1'
@@ -8,6 +8,7 @@ rvm:
8
8
  - 2.3.0
9
9
  - 2.4.0
10
10
  - 2.5.0
11
+ - 2.6.0
11
12
  - jruby-1.7.25
12
13
  - jruby-9.1.7.0
13
14
  - ruby-head
@@ -20,4 +21,5 @@ matrix:
20
21
  - rvm: jruby-head
21
22
 
22
23
  before_install:
23
- - gem install bundler
24
+ - rvm all-gemsets do gem uninstall bundler -ax || true
25
+ - gem install bundler -v "< 2"
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_development_dependency 'bundler', '~> 1.12'
23
23
  spec.add_development_dependency 'rake', '~> 11.0'
24
- spec.add_development_dependency 'minitest', '~> 5.0'
24
+ spec.add_development_dependency 'minitest', '~> 5.0', '< 5.11'
25
25
  spec.add_development_dependency 'minitest-colorin', '~> 0.1'
26
26
  spec.add_development_dependency 'minitest-line', '~> 0.6'
27
27
  spec.add_development_dependency 'simplecov', '~> 0.14'
@@ -2,6 +2,7 @@ require 'forwardable'
2
2
 
3
3
  require_relative 'hash_ext/version'
4
4
 
5
+ require_relative 'hash_ext/deep_freezable'
5
6
  require_relative 'hash_ext/normalized'
6
7
  require_relative 'hash_ext/builder'
7
8
  require_relative 'hash_ext/indifferent'
@@ -0,0 +1,25 @@
1
+ class Hash
2
+ module DeepFreezable
3
+
4
+ def deep_freeze
5
+ each_value { |v| deep_freeze_value v }
6
+ freeze
7
+ end
8
+
9
+ def deep_freeze_value(value)
10
+ if value.respond_to? :deep_freeze
11
+ value.deep_freeze
12
+ else
13
+ if value.is_a? Hash
14
+ value.each_value { |v| deep_freeze_value v }
15
+ elsif value.respond_to? :each
16
+ value.each { |v| deep_freeze_value v }
17
+ end
18
+ value.freeze
19
+ end
20
+ end
21
+
22
+ private :deep_freeze_value
23
+
24
+ end
25
+ end
@@ -1,6 +1,8 @@
1
1
  class Hash
2
2
  class Nested < Hash
3
3
 
4
+ include DeepFreezable
5
+
4
6
  def [](key)
5
7
  if key? key
6
8
  super(key)
@@ -1,6 +1,8 @@
1
1
  class Hash
2
2
  class Normalized < Hash
3
3
 
4
+ include DeepFreezable
5
+
4
6
  def self.subclass(&block)
5
7
  Class.new(self) do
6
8
  define_method :initialize do |hash={}|
@@ -3,6 +3,7 @@ class Hash
3
3
 
4
4
  extend Forwardable
5
5
  include Enumerable
6
+ include DeepFreezable
6
7
 
7
8
  def_delegators :@hash, :[], :[]=, :value?, :fetch, :values_at,
8
9
  :key?, :include?, :empty?,
@@ -1,3 +1,3 @@
1
1
  module HashExt
2
- VERSION = '0.4.0'
2
+ VERSION = '0.5.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-31 00:00:00.000000000 Z
11
+ date: 2019-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -45,6 +45,9 @@ dependencies:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '5.0'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '5.11'
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +55,9 @@ dependencies:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
57
  version: '5.0'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '5.11'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: minitest-colorin
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -142,6 +148,7 @@ files:
142
148
  - lib/hash_ext.rb
143
149
  - lib/hash_ext/accessible.rb
144
150
  - lib/hash_ext/builder.rb
151
+ - lib/hash_ext/deep_freezable.rb
145
152
  - lib/hash_ext/indifferent.rb
146
153
  - lib/hash_ext/nested.rb
147
154
  - lib/hash_ext/normalized.rb