hashie 3.5.7 → 5.0.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.
Files changed (85) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +281 -195
  3. data/CONTRIBUTING.md +13 -6
  4. data/LICENSE +1 -1
  5. data/README.md +320 -60
  6. data/Rakefile +2 -2
  7. data/UPGRADING.md +121 -7
  8. data/hashie.gemspec +13 -7
  9. data/lib/hashie/clash.rb +12 -1
  10. data/lib/hashie/dash.rb +56 -35
  11. data/lib/hashie/extensions/active_support/core_ext/hash.rb +14 -0
  12. data/lib/hashie/extensions/coercion.rb +26 -19
  13. data/lib/hashie/extensions/dash/indifferent_access.rb +29 -1
  14. data/lib/hashie/extensions/dash/predefined_values.rb +88 -0
  15. data/lib/hashie/extensions/dash/property_translation.rb +59 -28
  16. data/lib/hashie/extensions/deep_fetch.rb +5 -3
  17. data/lib/hashie/extensions/deep_find.rb +14 -5
  18. data/lib/hashie/extensions/deep_locate.rb +22 -8
  19. data/lib/hashie/extensions/deep_merge.rb +26 -10
  20. data/lib/hashie/extensions/ignore_undeclared.rb +4 -5
  21. data/lib/hashie/extensions/indifferent_access.rb +43 -10
  22. data/lib/hashie/extensions/key_conflict_warning.rb +55 -0
  23. data/lib/hashie/extensions/mash/define_accessors.rb +90 -0
  24. data/lib/hashie/extensions/mash/keep_original_keys.rb +4 -5
  25. data/lib/hashie/extensions/mash/permissive_respond_to.rb +61 -0
  26. data/lib/hashie/extensions/mash/safe_assignment.rb +3 -1
  27. data/lib/hashie/extensions/mash/symbolize_keys.rb +6 -6
  28. data/lib/hashie/extensions/method_access.rb +47 -14
  29. data/lib/hashie/extensions/parsers/yaml_erb_parser.rb +28 -4
  30. data/lib/hashie/extensions/ruby_version_check.rb +5 -1
  31. data/lib/hashie/extensions/strict_key_access.rb +16 -13
  32. data/lib/hashie/extensions/stringify_keys.rb +1 -1
  33. data/lib/hashie/extensions/symbolize_keys.rb +13 -2
  34. data/lib/hashie/hash.rb +18 -11
  35. data/lib/hashie/mash.rb +147 -81
  36. data/lib/hashie/railtie.rb +7 -0
  37. data/lib/hashie/rash.rb +6 -6
  38. data/lib/hashie/utils.rb +28 -0
  39. data/lib/hashie/version.rb +1 -1
  40. data/lib/hashie.rb +22 -19
  41. metadata +23 -131
  42. data/spec/hashie/array_spec.rb +0 -29
  43. data/spec/hashie/clash_spec.rb +0 -70
  44. data/spec/hashie/dash_spec.rb +0 -573
  45. data/spec/hashie/extensions/autoload_spec.rb +0 -24
  46. data/spec/hashie/extensions/coercion_spec.rb +0 -631
  47. data/spec/hashie/extensions/dash/coercion_spec.rb +0 -13
  48. data/spec/hashie/extensions/dash/indifferent_access_spec.rb +0 -84
  49. data/spec/hashie/extensions/deep_fetch_spec.rb +0 -97
  50. data/spec/hashie/extensions/deep_find_spec.rb +0 -138
  51. data/spec/hashie/extensions/deep_locate_spec.rb +0 -137
  52. data/spec/hashie/extensions/deep_merge_spec.rb +0 -70
  53. data/spec/hashie/extensions/ignore_undeclared_spec.rb +0 -47
  54. data/spec/hashie/extensions/indifferent_access_spec.rb +0 -282
  55. data/spec/hashie/extensions/indifferent_access_with_rails_hwia_spec.rb +0 -208
  56. data/spec/hashie/extensions/key_conversion_spec.rb +0 -12
  57. data/spec/hashie/extensions/mash/keep_original_keys_spec.rb +0 -46
  58. data/spec/hashie/extensions/mash/safe_assignment_spec.rb +0 -50
  59. data/spec/hashie/extensions/mash/symbolize_keys_spec.rb +0 -39
  60. data/spec/hashie/extensions/merge_initializer_spec.rb +0 -23
  61. data/spec/hashie/extensions/method_access_spec.rb +0 -188
  62. data/spec/hashie/extensions/strict_key_access_spec.rb +0 -110
  63. data/spec/hashie/extensions/stringify_keys_spec.rb +0 -124
  64. data/spec/hashie/extensions/symbolize_keys_spec.rb +0 -129
  65. data/spec/hashie/hash_spec.rb +0 -84
  66. data/spec/hashie/mash_spec.rb +0 -763
  67. data/spec/hashie/parsers/yaml_erb_parser_spec.rb +0 -46
  68. data/spec/hashie/rash_spec.rb +0 -83
  69. data/spec/hashie/trash_spec.rb +0 -268
  70. data/spec/hashie/utils_spec.rb +0 -25
  71. data/spec/hashie/version_spec.rb +0 -7
  72. data/spec/hashie_spec.rb +0 -13
  73. data/spec/integration/omniauth/app.rb +0 -11
  74. data/spec/integration/omniauth/integration_spec.rb +0 -38
  75. data/spec/integration/omniauth-oauth2/app.rb +0 -53
  76. data/spec/integration/omniauth-oauth2/integration_spec.rb +0 -26
  77. data/spec/integration/omniauth-oauth2/some_site.rb +0 -38
  78. data/spec/integration/rails/app.rb +0 -48
  79. data/spec/integration/rails/integration_spec.rb +0 -26
  80. data/spec/integration/rails-without-dependency/integration_spec.rb +0 -15
  81. data/spec/spec_helper.rb +0 -23
  82. data/spec/support/integration_specs.rb +0 -36
  83. data/spec/support/logger.rb +0 -24
  84. data/spec/support/module_context.rb +0 -11
  85. data/spec/support/ruby_version_check.rb +0 -6
metadata CHANGED
@@ -1,58 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashie
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.7
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
8
8
  - Jerry Cheung
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-19 00:00:00.000000000 Z
12
+ date: 2021-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rake
15
+ name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "<"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '11'
20
+ version: '0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "<"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '11'
28
- - !ruby/object:Gem::Dependency
29
- name: rspec
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: '3.0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '3.0'
42
- - !ruby/object:Gem::Dependency
43
- name: rspec-pending_for
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - "~>"
47
- - !ruby/object:Gem::Version
48
- version: '0.1'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - "~>"
54
- - !ruby/object:Gem::Version
55
- version: '0.1'
27
+ version: '0'
56
28
  description: Hashie is a collection of classes and mixins that make hashes more powerful.
57
29
  email:
58
30
  - michael@intridea.com
@@ -73,10 +45,12 @@ files:
73
45
  - lib/hashie/array.rb
74
46
  - lib/hashie/clash.rb
75
47
  - lib/hashie/dash.rb
48
+ - lib/hashie/extensions/active_support/core_ext/hash.rb
76
49
  - lib/hashie/extensions/array/pretty_inspect.rb
77
50
  - lib/hashie/extensions/coercion.rb
78
51
  - lib/hashie/extensions/dash/coercion.rb
79
52
  - lib/hashie/extensions/dash/indifferent_access.rb
53
+ - lib/hashie/extensions/dash/predefined_values.rb
80
54
  - lib/hashie/extensions/dash/property_translation.rb
81
55
  - lib/hashie/extensions/deep_fetch.rb
82
56
  - lib/hashie/extensions/deep_find.rb
@@ -84,8 +58,11 @@ files:
84
58
  - lib/hashie/extensions/deep_merge.rb
85
59
  - lib/hashie/extensions/ignore_undeclared.rb
86
60
  - lib/hashie/extensions/indifferent_access.rb
61
+ - lib/hashie/extensions/key_conflict_warning.rb
87
62
  - lib/hashie/extensions/key_conversion.rb
63
+ - lib/hashie/extensions/mash/define_accessors.rb
88
64
  - lib/hashie/extensions/mash/keep_original_keys.rb
65
+ - lib/hashie/extensions/mash/permissive_respond_to.rb
89
66
  - lib/hashie/extensions/mash/safe_assignment.rb
90
67
  - lib/hashie/extensions/mash/symbolize_keys.rb
91
68
  - lib/hashie/extensions/merge_initializer.rb
@@ -105,55 +82,15 @@ files:
105
82
  - lib/hashie/trash.rb
106
83
  - lib/hashie/utils.rb
107
84
  - lib/hashie/version.rb
108
- - spec/hashie/array_spec.rb
109
- - spec/hashie/clash_spec.rb
110
- - spec/hashie/dash_spec.rb
111
- - spec/hashie/extensions/autoload_spec.rb
112
- - spec/hashie/extensions/coercion_spec.rb
113
- - spec/hashie/extensions/dash/coercion_spec.rb
114
- - spec/hashie/extensions/dash/indifferent_access_spec.rb
115
- - spec/hashie/extensions/deep_fetch_spec.rb
116
- - spec/hashie/extensions/deep_find_spec.rb
117
- - spec/hashie/extensions/deep_locate_spec.rb
118
- - spec/hashie/extensions/deep_merge_spec.rb
119
- - spec/hashie/extensions/ignore_undeclared_spec.rb
120
- - spec/hashie/extensions/indifferent_access_spec.rb
121
- - spec/hashie/extensions/indifferent_access_with_rails_hwia_spec.rb
122
- - spec/hashie/extensions/key_conversion_spec.rb
123
- - spec/hashie/extensions/mash/keep_original_keys_spec.rb
124
- - spec/hashie/extensions/mash/safe_assignment_spec.rb
125
- - spec/hashie/extensions/mash/symbolize_keys_spec.rb
126
- - spec/hashie/extensions/merge_initializer_spec.rb
127
- - spec/hashie/extensions/method_access_spec.rb
128
- - spec/hashie/extensions/strict_key_access_spec.rb
129
- - spec/hashie/extensions/stringify_keys_spec.rb
130
- - spec/hashie/extensions/symbolize_keys_spec.rb
131
- - spec/hashie/hash_spec.rb
132
- - spec/hashie/mash_spec.rb
133
- - spec/hashie/parsers/yaml_erb_parser_spec.rb
134
- - spec/hashie/rash_spec.rb
135
- - spec/hashie/trash_spec.rb
136
- - spec/hashie/utils_spec.rb
137
- - spec/hashie/version_spec.rb
138
- - spec/hashie_spec.rb
139
- - spec/integration/omniauth-oauth2/app.rb
140
- - spec/integration/omniauth-oauth2/integration_spec.rb
141
- - spec/integration/omniauth-oauth2/some_site.rb
142
- - spec/integration/omniauth/app.rb
143
- - spec/integration/omniauth/integration_spec.rb
144
- - spec/integration/rails-without-dependency/integration_spec.rb
145
- - spec/integration/rails/app.rb
146
- - spec/integration/rails/integration_spec.rb
147
- - spec/spec_helper.rb
148
- - spec/support/integration_specs.rb
149
- - spec/support/logger.rb
150
- - spec/support/module_context.rb
151
- - spec/support/ruby_version_check.rb
152
- homepage: https://github.com/intridea/hashie
85
+ homepage: https://github.com/hashie/hashie
153
86
  licenses:
154
87
  - MIT
155
- metadata: {}
156
- post_install_message:
88
+ metadata:
89
+ bug_tracker_uri: https://github.com/hashie/hashie/issues
90
+ changelog_uri: https://github.com/hashie/hashie/blob/master/CHANGELOG.md
91
+ documentation_uri: https://www.rubydoc.info/gems/hashie
92
+ source_code_uri: https://github.com/hashie/hashie
93
+ post_install_message:
157
94
  rdoc_options: []
158
95
  require_paths:
159
96
  - lib
@@ -168,53 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
105
  - !ruby/object:Gem::Version
169
106
  version: '0'
170
107
  requirements: []
171
- rubyforge_project:
172
- rubygems_version: 2.6.13
173
- signing_key:
108
+ rubygems_version: 3.1.3
109
+ signing_key:
174
110
  specification_version: 4
175
111
  summary: Your friendly neighborhood hash library.
176
- test_files:
177
- - spec/hashie/parsers/yaml_erb_parser_spec.rb
178
- - spec/hashie/array_spec.rb
179
- - spec/hashie/hash_spec.rb
180
- - spec/hashie/version_spec.rb
181
- - spec/hashie/clash_spec.rb
182
- - spec/hashie/mash_spec.rb
183
- - spec/hashie/extensions/stringify_keys_spec.rb
184
- - spec/hashie/extensions/deep_locate_spec.rb
185
- - spec/hashie/extensions/coercion_spec.rb
186
- - spec/hashie/extensions/mash/safe_assignment_spec.rb
187
- - spec/hashie/extensions/mash/symbolize_keys_spec.rb
188
- - spec/hashie/extensions/mash/keep_original_keys_spec.rb
189
- - spec/hashie/extensions/key_conversion_spec.rb
190
- - spec/hashie/extensions/ignore_undeclared_spec.rb
191
- - spec/hashie/extensions/autoload_spec.rb
192
- - spec/hashie/extensions/strict_key_access_spec.rb
193
- - spec/hashie/extensions/deep_fetch_spec.rb
194
- - spec/hashie/extensions/method_access_spec.rb
195
- - spec/hashie/extensions/deep_find_spec.rb
196
- - spec/hashie/extensions/deep_merge_spec.rb
197
- - spec/hashie/extensions/merge_initializer_spec.rb
198
- - spec/hashie/extensions/indifferent_access_with_rails_hwia_spec.rb
199
- - spec/hashie/extensions/dash/coercion_spec.rb
200
- - spec/hashie/extensions/dash/indifferent_access_spec.rb
201
- - spec/hashie/extensions/symbolize_keys_spec.rb
202
- - spec/hashie/extensions/indifferent_access_spec.rb
203
- - spec/hashie/rash_spec.rb
204
- - spec/hashie/utils_spec.rb
205
- - spec/hashie/dash_spec.rb
206
- - spec/hashie/trash_spec.rb
207
- - spec/spec_helper.rb
208
- - spec/integration/rails-without-dependency/integration_spec.rb
209
- - spec/integration/omniauth-oauth2/integration_spec.rb
210
- - spec/integration/omniauth-oauth2/app.rb
211
- - spec/integration/omniauth-oauth2/some_site.rb
212
- - spec/integration/omniauth/integration_spec.rb
213
- - spec/integration/omniauth/app.rb
214
- - spec/integration/rails/integration_spec.rb
215
- - spec/integration/rails/app.rb
216
- - spec/support/module_context.rb
217
- - spec/support/logger.rb
218
- - spec/support/integration_specs.rb
219
- - spec/support/ruby_version_check.rb
220
- - spec/hashie_spec.rb
112
+ test_files: []
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Array do
4
- with_minimum_ruby('2.3.0') do
5
- describe '#dig' do
6
- let(:array) { Hashie::Array.new([:a, :b, :c]) }
7
-
8
- it 'works with a string index' do
9
- expect(array.dig('0')).to eq(:a)
10
- end
11
-
12
- it 'works with a numeric index' do
13
- expect(array.dig(1)).to eq(:b)
14
- end
15
-
16
- context 'when array is empty' do
17
- let(:array) { Hashie::Array.new([]) }
18
-
19
- it 'works with a first numeric and next string index' do
20
- expect(array.dig(0, 'hello')).to eq(nil)
21
- end
22
-
23
- it 'throws an error with first string and next numeric index' do
24
- expect { array.dig('hello', 0) }.to raise_error(TypeError)
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,70 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Hashie::Clash do
4
- it 'is able to set an attribute via method_missing' do
5
- subject.foo('bar')
6
- expect(subject[:foo]).to eq 'bar'
7
- end
8
-
9
- it 'is able to set multiple attributes' do
10
- subject.foo('bar').baz('wok')
11
- expect(subject).to eq(foo: 'bar', baz: 'wok')
12
- end
13
-
14
- it 'converts multiple arguments into an array' do
15
- subject.foo(1, 2, 3)
16
- expect(subject[:foo]).to eq [1, 2, 3]
17
- end
18
-
19
- it 'is able to use bang notation to create a new Clash on a key' do
20
- subject.foo!
21
- expect(subject[:foo]).to be_kind_of(Hashie::Clash)
22
- end
23
-
24
- it 'is able to chain onto the new Clash when using bang notation' do
25
- subject.foo!.bar('abc').baz(123)
26
- expect(subject).to eq(foo: { bar: 'abc', baz: 123 })
27
- end
28
-
29
- it 'is able to jump back up to the parent in the chain with #_end!' do
30
- subject.foo!.bar('abc')._end!.baz(123)
31
- expect(subject).to eq(foo: { bar: 'abc' }, baz: 123)
32
- end
33
-
34
- it 'merges rather than replaces existing keys' do
35
- subject.where(abc: 'def').where(hgi: 123)
36
- expect(subject).to eq(where: { abc: 'def', hgi: 123 })
37
- end
38
-
39
- it 'is able to replace all of its own keys with #replace' do
40
- subject.foo(:bar).hello(:world)
41
- expect(subject.replace(baz: 123, hgi: 123)).to eq(baz: 123, hgi: 123)
42
- expect(subject).to eq(baz: 123, hgi: 123)
43
- expect(subject[:foo]).to be_nil
44
- expect(subject[:hello]).to be_nil
45
- end
46
-
47
- it 'merges multiple bang notation calls' do
48
- subject.where!.foo(123)
49
- subject.where!.bar(321)
50
- expect(subject).to eq(where: { foo: 123, bar: 321 })
51
- end
52
-
53
- it 'raises an exception when method is missing' do
54
- expect { subject.boo }.to raise_error(NoMethodError)
55
- end
56
-
57
- describe 'when inherited' do
58
- subject { Class.new(described_class).new }
59
-
60
- it 'bang nodes are instances of a subclass' do
61
- subject.where!.foo(123)
62
- expect(subject[:where]).to be_instance_of(subject.class)
63
- end
64
-
65
- it 'merged nodes are instances of a subclass' do
66
- subject.where(abc: 'def').where(hgi: 123)
67
- expect(subject[:where]).to be_instance_of(subject.class)
68
- end
69
- end
70
- end