darthjee-core_ext 1.7.4 → 2.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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +7 -1
  3. data/.gitignore +2 -0
  4. data/.reek.yml +3 -0
  5. data/ARRAY_README.md +72 -15
  6. data/CLASS_README.md +154 -0
  7. data/DATE_README.md +19 -9
  8. data/Dockerfile +2 -5
  9. data/ENUMERABLE_README.md +154 -4
  10. data/HASH_README.md +276 -135
  11. data/MATH_README.md +14 -10
  12. data/OBJECT_README.md +18 -35
  13. data/README.md +8 -4
  14. data/Rakefile +1 -0
  15. data/SYMBOL_README.md +13 -18
  16. data/config/rubycritc.rb +12 -0
  17. data/config/yardstick.yml +45 -3
  18. data/core_ext.gemspec +10 -8
  19. data/docker-compose.yml +15 -7
  20. data/lib/darthjee/core_ext/array.rb +17 -12
  21. data/lib/darthjee/core_ext/array/hash_builder.rb +20 -4
  22. data/lib/darthjee/core_ext/class.rb +28 -10
  23. data/lib/darthjee/core_ext/date.rb +1 -0
  24. data/lib/darthjee/core_ext/enumerable.rb +67 -30
  25. data/lib/darthjee/core_ext/hash.rb +4 -2
  26. data/lib/darthjee/core_ext/hash/cameliazable.rb +39 -8
  27. data/lib/darthjee/core_ext/hash/chain_fetcher.rb +17 -1
  28. data/lib/darthjee/core_ext/hash/changeable.rb +88 -0
  29. data/lib/darthjee/core_ext/hash/deep_hash_constructor.rb +127 -63
  30. data/lib/darthjee/core_ext/hash/deep_hash_constructor/setter.rb +112 -0
  31. data/lib/darthjee/core_ext/hash/key_changeable.rb +126 -54
  32. data/lib/darthjee/core_ext/hash/key_changer.rb +140 -40
  33. data/lib/darthjee/core_ext/hash/keys_sorter.rb +42 -6
  34. data/lib/darthjee/core_ext/hash/squasher.rb +131 -18
  35. data/lib/darthjee/core_ext/hash/transformable.rb +133 -41
  36. data/lib/darthjee/core_ext/hash/transposeable.rb +37 -8
  37. data/lib/darthjee/core_ext/hash/value_changer.rb +76 -36
  38. data/lib/darthjee/core_ext/math.rb +37 -6
  39. data/lib/darthjee/core_ext/numeric.rb +10 -0
  40. data/lib/darthjee/core_ext/object.rb +29 -0
  41. data/lib/darthjee/core_ext/symbol.rb +22 -2
  42. data/lib/darthjee/core_ext/version.rb +1 -1
  43. data/scripts/check_readme.sh +6 -0
  44. data/scripts/rubycritic.sh +10 -0
  45. data/spec/integration/readme/array_spec.rb +96 -0
  46. data/spec/integration/readme/class_spec.rb +123 -0
  47. data/spec/integration/readme/date_spec.rb +20 -0
  48. data/spec/integration/readme/enumerable_spec.rb +87 -0
  49. data/spec/integration/readme/hash_spec.rb +391 -0
  50. data/spec/integration/readme/math_spec.rb +31 -0
  51. data/spec/integration/readme/object_spec.rb +49 -0
  52. data/spec/integration/readme/symbol_spec.rb +29 -0
  53. data/spec/integration/yard/darthjee/core_ext/enumerable_spec.rb +24 -4
  54. data/spec/integration/yard/darthjee/core_ext/hash/cameliazable_spec.rb +11 -0
  55. data/spec/integration/yard/darthjee/core_ext/hash/changeable_spec.rb +68 -0
  56. data/spec/integration/yard/darthjee/core_ext/hash/deep_hash_constructor/setter_spec.rb +34 -0
  57. data/spec/integration/yard/darthjee/core_ext/hash/deep_hash_constructor_spec.rb +65 -0
  58. data/spec/integration/yard/darthjee/core_ext/hash/key_changeable_spec.rb +8 -0
  59. data/spec/integration/yard/darthjee/core_ext/hash/key_changer_spec.rb +59 -0
  60. data/spec/integration/yard/darthjee/core_ext/hash/keys_sorter_spec.rb +25 -0
  61. data/spec/integration/yard/darthjee/core_ext/hash/squasher_spec.rb +60 -0
  62. data/spec/integration/yard/darthjee/core_ext/hash/transformable_spec.rb +66 -36
  63. data/spec/integration/yard/darthjee/core_ext/hash/transposeable_spec.rb +35 -0
  64. data/spec/integration/yard/darthjee/core_ext/hash_spec.rb +13 -2
  65. data/spec/integration/yard/darthjee/core_ext/math_spec.rb +28 -0
  66. data/spec/integration/yard/darthjee/core_ext/numeric_spec.rb +11 -0
  67. data/spec/integration/yard/darthjee/core_ext/object_spec.rb +47 -0
  68. data/spec/integration/yard/darthjee/core_ext/symbol_spec.rb +17 -0
  69. data/spec/lib/darthjee/core_ext/hash/deep_hash_constructor/setter_spec.rb +64 -0
  70. data/spec/lib/darthjee/core_ext/hash/deep_hash_constructor_spec.rb +16 -156
  71. data/spec/lib/darthjee/core_ext/hash/keys_sorter_spec.rb +5 -4
  72. data/spec/lib/darthjee/core_ext/hash/squasher_spec.rb +8 -2
  73. data/spec/lib/darthjee/core_ext/hash/value_changer_spec.rb +4 -12
  74. data/spec/lib/hash_spec.rb +92 -146
  75. data/spec/lib/object_spec.rb +32 -0
  76. data/spec/support/models/client.rb +22 -0
  77. data/spec/support/shared_examples/hash/deep_hash.rb +166 -0
  78. data/spec/support/shared_examples/hash/hash_squasher.rb +54 -9
  79. data/spec/support/shared_examples/hash/keys_sorter.rb +266 -6
  80. metadata +70 -8
  81. data/lib/darthjee/core_ext/hash/to_hash_mapper.rb +0 -25
  82. data/spec/lib/darthjee/core_ext/hash/to_hash_mapper_spec.rb +0 -11
@@ -1,195 +1,248 @@
1
1
  ## Hash
2
- ### #map_to_hash
3
- map returning a hash with the original keys
4
-
5
- ```ruby
6
- hash = { a: 1, b: 2 }
7
- hash.map_to_hash { |k, v| "#{k}_#{v}" }
8
- { a: "a_1", b: "b_2" }
9
- ```
10
2
 
11
- ### #chain_fetch
12
- Applies fetch in a chain
3
+ ### #append_to_keys
4
+ Change each keys appending an string
13
5
 
14
6
  ```ruby
15
- { a: { b: { c: { d: 10 } } } }.chain_fetch(:a, :b, :c, :d)
16
- 10
7
+ { key: 1 }.append_to_keys 's'
8
+
9
+ # returns { keys: 1 }
17
10
  ```
18
11
 
19
- A block can be passed so that when a key is not found, the block will define the value to be returned
12
+ ### #camelize_keys
13
+ Change the keys camelizing them and accepting parameters:
14
+ - uppercase_first_letter: Use the java or javascript format (default: true)
15
+ - recursive: when true, does it recursivly through inner arrays (default: true)
20
16
 
21
17
  ```ruby
22
- h = { a: { b: { c: { d: 10 } } } }
23
- h.chain_fetch(:a, :x, :y, :z) { |key, missed_keys| "returned #{key}" }
24
- 'returned x'
25
- ```
18
+ hash = { ca_b: 1, k: [{ a_b: 1 }] }
26
19
 
27
- ### #squash
28
- Squash a deep hash into a simple level hash
20
+ hash.camelize_keys # return { CaB: 1, K: [{ AB: 1 }] }
21
+ ```
29
22
 
30
23
  ```ruby
31
- { a: { b:1 } }.squash
24
+ hash = { ca_b: 1, k: [{ a_b: 1 }] }
25
+
26
+ hash.camelize_keys(recursive: false)
27
+ # returns { CaB: 1, K: [{ a_b: 1 }] }
32
28
  ```
33
- returns
29
+
34
30
  ```ruby
35
- { 'a.b' => 1 }
36
- ```
31
+ hash = { ca_b: 1, k: [{ a_b: 1 }] }
37
32
 
38
- ### #to_deep_hash
39
- Changes a hash spliting keys into inner hashs
33
+ hash.camelize_keys(uppercase_first_letter: false)
40
34
 
41
- ```ruby
42
- { 'a.b' => 1 }.to_deep_hash
43
- ```
44
- returns
45
- ```ruby
46
- { 'a' => { 'b' => 1 } }
35
+ # returns { caB: 1, k: [{ aB: 1 }] }
47
36
  ```
48
37
 
49
- ### #change_keys
50
- Change the array keys using a block accepting parameters:
51
- - recursive: when true, does it recursivly through inner arrays (default: true)
38
+ ### #camelize_keys!
39
+ Change the keys camelizing them and accepting parameters:
40
+ - uppercase_first_letter: Use the java or javascript format (default: true)
41
+ - recursive: when true, does it recursivly through inner arrays (default: true)
52
42
 
53
43
  ```ruby
54
- { ca_b: 1, k: [{ a_b: 1 }] }.change_keys { |k| k.to_s.upcase }
55
- ```
56
- returns
57
- ```ruby
58
- {"CA_B"=>1, "K"=>[{"A_B"=>1}]}
44
+ hash = { ca_b: 1, k: [{ a_b: 1 }] }
45
+
46
+ hash.camelize_keys!
47
+
48
+ # changes hash to { CaB: 1, K: [{ AB: 1 }] }
59
49
  ```
60
50
 
61
51
  ```ruby
62
- { ca_b: 1, k: [{ a_b: 1 }] }.change_keys(recursive: false) { |k| k.to_s.upcase }
52
+ hash = { ca_b: 1, k: [{ a_b: 1 }] }
53
+
54
+ hash.camelize_keys!(recursive: false)
55
+
56
+ # changes hash to { CaB: 1, K: [{ a_b: 1 }] }
63
57
  ```
64
- returns
58
+
65
59
  ```ruby
66
- {"CA_B"=>1, "K"=>[{:a_b=>1}]}
60
+ hash = { ca_b: 1, k: [{ a_b: 1 }] }
61
+
62
+ hash.camelize_keys!(uppercase_first_letter: false)
63
+
64
+ # changes hash to { caB: 1, k: [{ aB: 1 }] }
67
65
  ```
68
66
 
69
67
  ### #chain_change_keys
70
- Change the hash keys usin a chained method call
68
+ Returns new hash changing the keys using a chained method call
71
69
 
72
70
  ```ruby
73
- { ca_b: 1 }.chain_change_keys(:to_s, :upcase, :to_sym)
74
- ```
75
- returns
76
- ```ruby
77
- { CA_B: 1 }
71
+ { ca_b: 1 }.chain_change_keys(:to_s, :upcase, :to_sym)
72
+
73
+ # returns { CA_B: 1 }
78
74
  ```
79
75
 
80
- ### #camelize_keys
81
- Change the keys camelizing them and accepting parameters:
82
- - uppercase_first_letter: Use the java or javascript format (default: true)
83
- - recursive: when true, does it recursivly through inner arrays (default: true)
76
+ ### #chain_change_keys!
77
+ Change the hash keys using a chained method call
84
78
 
85
79
  ```ruby
86
- { ca_b: 1, k: [{ a_b: 1 }] }.camelize_keys
87
- ```
88
- returns
89
- ```ruby
90
- {:CaB=>1, :K=>[{:AB=>1}]}
91
- ```
80
+ { ca_b: 1 }.chain_change_keys!(:to_s, :upcase, :to_sym)
92
81
 
93
- ```ruby
94
- { ca_b: 1, k: [{ a_b: 1 }] }.camelize_keys(recursive: false)
95
- ```
96
- returns
97
- ```ruby
98
- {:CaB=>1, :K=>[{:a_b=>1}]}
82
+ # changes hash to { CA_B: 1 }
99
83
  ```
100
84
 
85
+ ### #chain_fetch
86
+ Applies fetch in a chain
87
+
101
88
  ```ruby
102
- { ca_b: 1, k: [{ a_b: 1 }] }.camelize_keys(uppercase_first_letter: false)
89
+ hash = { a: { b: { c: { d: 10 } } } }
90
+
91
+ hash.chain_fetch(:a, :b, :c, :d) # returns 10
103
92
  ```
104
- returns
93
+
94
+ A block can be passed so that when a key is not found, the block will define the value to be returned
95
+
105
96
  ```ruby
106
- {:caB=>1, :k=>[{:aB=>1}]}
97
+ hash = { a: { b: { c: { d: 10 } } } }
98
+
99
+ hash.chain_fetch(:a, :x, :y, :z) do |key, missed_keys|
100
+ "returned: #{key}\nmissed: [#{missed_keys.join(',')}]"
101
+ end
102
+
103
+ # returns "returned x\nmissed: [y,z]"
107
104
  ```
108
105
 
109
- ### #lower_camelize_keys
110
- Alias for [#camelize_keys](camelize_keys)(uppercase_first_letter: false)
106
+ ### #change_keys
107
+ Change the array keys using a block accepting parameters:
108
+ - recursive: when true, does it recursivly through inner arrays (default: true)
111
109
 
112
110
  ```ruby
113
- { ca_b: 1, k: [{ a_b: 1 }] }.lower_camelize_keys
111
+ { ca_b: 1, k: [{ a_b: 1 }] }.change_keys { |k| k.to_s.upcase }
112
+
113
+ # reutrns {"CA_B"=>1, "K"=>[{"A_B"=>1}]}
114
114
  ```
115
- returns
115
+
116
116
  ```ruby
117
- {:caB=>1, :k=>[{:aB=>1}]}
117
+ { ca_b: 1, k: [{ a_b: 1 }] }.change_keys(recursive: false) { |k| k.to_s.upcase }
118
+
119
+ # returns {"CA_B"=>1, "K"=>[{:a_b=>1}]}
118
120
  ```
119
121
 
120
- ### #underscore_keys
121
- Change the keys from camelcase to snakecase (underscore)
122
+ ### #change_keys!
123
+ Change the array keys using a block accepting parameters:
122
124
  - recursive: when true, does it recursivly through inner arrays (default: true)
123
125
 
124
126
  ```ruby
125
- { Ca_B: 1, 'kB' => [{ KeysHash: 1 }] }.underscore_keys
127
+ { ca_b: 1, k: [{ a_b: 1 }] }.change_keys! { |k| k.to_s.upcase }
128
+
129
+ # changes hash to {"CA_B"=>1, "K"=>[{"A_B"=>1}]}
126
130
  ```
127
- returns
131
+
128
132
  ```ruby
129
- {ca_b: 1, "k_b"=>[{keys_hash: 1}]}
133
+ { ca_b: 1, k: [{ a_b: 1 }] }.change_keys!(recursive: false) { |k| k.to_s.upcase }
134
+
135
+ # changes hash to {"CA_B"=>1, "K"=>[{:a_b=>1}]}
130
136
  ```
131
137
 
132
138
  ### #change_values
133
- Change the values of the array accepting parametes:
139
+ Returns new hash changing the values of the hash, accepting parametes:
134
140
  - recursive: when true, does it recursivly through inner arrays and hashes (default: true)
135
141
  - skip_inner: when true, do not call the block for iterators such as Hash and Arrays (default: true)
136
142
 
137
143
  ```ruby
138
- { a: 1, b: [{ c: 2 }] }.change_values { |v| (v+1).to_s }
139
- ```
140
- returns
141
- ```ruby
142
- { a: '2' b: [{ c: '3' }] }
143
- ```
144
+ hash = { a: 1, b: [{ c: 2 }] }
144
145
 
145
- ```ruby
146
- { a: 1, b: [{ c: 2 }] }.change_values(recursive: false) { |v| (v+1).to_s }
146
+ hash.change_values { |v| (v+1).to_s }
147
+
148
+ # returns { a: '2', b: [{ c: '3' }] }
147
149
  ```
148
- returns
150
+
149
151
  ```ruby
150
- { a: '2' b: [{ c: 2 }] }
152
+ hash = { a: 1, b: [{ c: 2 }] }
153
+ hash.change_values(recursive: false) { |v| (v+1).to_s }
154
+
155
+ # returns { a: '2' b: [{ c: 2 }] }
151
156
  ```
152
157
 
153
158
  ```ruby
154
- { a: 1, b: [{ c: 2 }] }.change_values(skip_inner: false) do |v|
155
- v.is_a?(Integer) ? (v+1).to_s : v.class
159
+ hash = { a: 1, b: [{ c: 2 }], d: { e: 3 } }
160
+ hash.change_values(skip_inner: false) do |v|
161
+ case value
162
+ when Integer
163
+ (value + 1).to_s
164
+ when Hash
165
+ value.to_s
166
+ else
167
+ value.class
156
168
  end
169
+ end
170
+
171
+ # returns { a: '2' b: Array, d: "{:e=>3}" }
157
172
  ```
158
- returns
173
+
174
+ ### #change_values!
175
+ Change the values of the hash accepting parametes:
176
+ - recursive: when true, does it recursivly through inner arrays and hashes (default: true)
177
+ - skip_inner: when true, do not call the block for iterators such as Hash and Arrays (default: true)
178
+
159
179
  ```ruby
160
- { a: '2' b: Array }
161
- ```
180
+ hash = { a: 1, b: [{ c: 2 }] }
162
181
 
163
- ### #prepend_to_keys
164
- Change each keys prepending an string
182
+ hash.change_values! { |v| (v+1).to_s }
183
+
184
+ # changes hash to { a: '2', b: [{ c: '3' }] }
185
+ ```
165
186
 
166
187
  ```ruby
167
- { key: 1 }.prepend_to_keys 'scope:'
188
+ hash = { a: 1, b: [{ c: 2 }] }
189
+ hash.change_values!(recursive: false) { |v| (v+1).to_s }
190
+
191
+ # changes hash to { a: '2' b: [{ c: 2 }] }
168
192
  ```
169
- returns
193
+
170
194
  ```ruby
171
- { :'scope:key' => 1 }
195
+ hash = { a: 1, b: [{ c: 2 }], d: { e: 3 } }
196
+ hash.change_values!(skip_inner: false) do |v|
197
+ case value
198
+ when Integer
199
+ (value + 1).to_s
200
+ when Hash
201
+ value.to_s
202
+ else
203
+ value.class
204
+ end
205
+ end
206
+
207
+ # changes hash to { a: '2' b: Array, d: "{:e=>3}" }
172
208
  ```
173
- ### #append_to_keys
174
- Change each keys appending an string
209
+
210
+ ### #exclusive_merge
211
+ Like #merge but only for existing keys
175
212
 
176
213
  ```ruby
177
- { key: 1 }.append_to_keys 's'
214
+ { a: 1, b: 2 }.exclusive_merge(b: 3, c: 4)
215
+
216
+ # returns { a: 1, b: 3 }
178
217
  ```
179
- returns
218
+
219
+ ### #exclusive_merge!
220
+ Like #merge! but only for existing keys
221
+
180
222
  ```ruby
181
- { keys: 1 }
223
+ { a: 1, b: 2 }.exclusive_merge!(b: 3, c: 4)
224
+
225
+ # changes hash to { a: 1, b: 3 }
182
226
  ```
183
227
 
184
- ### #sort_keys
185
- Sort the hash usig the keys
228
+ ### #lower_camelize_keys
229
+ Alias for [#camelize_keys](camelize_keys)(uppercase_first_letter: false)
186
230
 
187
231
  ```ruby
188
- { b:1, a:2 }.sort_keys
232
+ hash = { ca_b: 1, k: [{ a_b: 1 }] }
233
+
234
+ hash.lower_camelize_keys
235
+ # returns { caB: 1, k: [{ aB: 1 }] }
189
236
  ```
190
- returns
237
+
238
+ ### #lower_camelize_keys!
239
+ Alias for [#camelize_keys](camelize_keys)(uppercase_first_letter: false)
240
+
191
241
  ```ruby
192
- { a:2, b:1 }
242
+ hash = { ca_b: 1, k: [{ a_b: 1 }] }
243
+
244
+ hash.lower_camelize_keys!
245
+ # changes hash to { caB: 1, k: [{ aB: 1 }] }
193
246
  ```
194
247
 
195
248
  ### #map_to_hash
@@ -197,58 +250,104 @@ map returning a hash with the original keys for keys
197
250
 
198
251
  ```ruby
199
252
  hash = { a: 1, b: 2 }
253
+
200
254
  hash.map_to_hash { |k, v| "#{k}_#{v}" }
201
- { a: 'a_1', b: 'b_2' }
255
+
256
+ # returns { a: 'a_1', b: 'b_2' }
257
+ ```
258
+
259
+ ### #prepend_to_keys
260
+ Change each keys prepending an string
261
+
262
+ ```ruby
263
+ { key: 1 }.prepend_to_keys 'scope:'
264
+
265
+ # returns { :'scope:key' => 1 }
202
266
  ```
203
267
 
204
268
  ### #remap_keys
205
- Changes the keys of the hash based on a map of { old: new } value
269
+ Returns new hash changing the keys of the hash based
270
+ on a map of { old: new } value
206
271
 
207
272
  ```ruby
208
273
  hash = { a: 1, b: 2 }
209
274
  hash.remap_keys(a: :c, d: :e)
210
- { c: 1, b: 2, e: nil }
275
+
276
+ # returns { c: 1, b: 2, e: nil }
211
277
  ```
212
278
 
213
- ### #exclusive_merge
214
- Like #merge but only for existing keys
279
+ ### #remap_keys!
280
+ Changes the keys of the hash based on a map of { old: new } value
215
281
 
216
282
  ```ruby
217
- { a: 1, b: 2 }.exclusive_merge(b: 3, c: 4)
218
- { a: 1, b: 3 }
283
+ hash = { a: 1, b: 2 }
284
+ hash.remap_keys!(a: :c, d: :e)
285
+
286
+ # change hash to { c: 1, b: 2, e: nil }
219
287
  ```
220
288
 
221
- ### #clean
222
- Cleans empty values from a hash
289
+ ### #sort_keys
290
+ Sort the hash usig the keys
291
+
223
292
  ```ruby
224
- { a: 1, b: [], c: nil, d: {}, e: '', f: { b: [], c: nil, d: {}, e: '' } }.clean
293
+ { b: 1, a: 2 }.sort_keys.keys
294
+
295
+ # returns [:a, :b]
225
296
  ```
226
- returns
297
+
298
+ ### #sort_keys!
299
+ Sort the hash usig the keys
300
+
227
301
  ```ruby
228
- {}
302
+ hash = { b: 1, a: 2 }
303
+ hash.sort_keys
304
+ hash.keys
305
+
306
+ # returns [:a, :b]
229
307
  ```
230
308
 
231
- ### #map_and_find
232
- Operates like map, but will stop as soon as a non false value is found returning the value found
309
+ ### #squash
310
+ Squash a deep hash into a simple level hash
233
311
 
234
312
  ```ruby
235
- class Ob
236
- attr_reader :v
237
- def initialize(v = nil)
238
- @v = v
239
- end
240
- end
241
- hash = { a: Ob.new, b: Ob.new(false), c: Ob.new(1), d: Ob.new(3) }
313
+ { a: { b: [1, 2] } }.squash
314
+
315
+ #returns { 'a.b[0]' => 1, 'a.b[1]' => 2 }
242
316
  ```
243
317
 
318
+ ### #squash!
319
+ Squash a deep hash into a simple level hash
320
+
244
321
  ```ruby
245
- hash.map_and_find { |k,o| o.v }
246
- 1
322
+ { a: { b: [1, 2] } }.squash!
323
+
324
+ # changes hash to { 'a.b[0]' => 1, 'a.b[1]' => 2 }
325
+ ```
326
+
327
+ ### #underscore_keys
328
+ Creates a new hash changing keys from camelcase to snakecase (underscore)
329
+
330
+ options:
331
+ - recursive: when true, does it recursivly through inner arrays (default: true)
332
+
333
+ ```ruby
334
+ hash = { Ca_B: 1, 'kB' => [{ KeysHash: 1 }] }
335
+
336
+ hash.underscore_keys
337
+ # returns { ca_b: 1, 'k_b' => [{ keys_hash: 1 }] }
247
338
  ```
248
339
 
340
+ ### #underscore_keys!
341
+ Change the keys from camelcase to snakecase (underscore)
342
+
343
+ options:
344
+ - recursive: when true, does it recursivly through inner arrays (default: true)
345
+
249
346
  ```ruby
250
- hash.map_and_find { |k,o| o.v && k }
251
- :c
347
+ hash = { Ca_B: 1, 'kB' => [{ KeysHash: 1 }] }
348
+
349
+ hash.underscore_keys!
350
+ # changes hash to { ca_b: 1, 'k_b' => [{ keys_hash: 1 }] }
252
351
  ```
253
352
 
254
353
  ### #transpose
@@ -256,10 +355,52 @@ swap keys with values of the hash
256
355
 
257
356
  ```ruby
258
357
  { a: 1, b: :a, c: [2, 3] }.transpose
358
+
359
+ # returns { 1 => :a, a: :b, [2, 3] => :c }
259
360
  ```
260
361
 
261
- returns
362
+ ### #transpose!
363
+ Changes hash swapping keys with values of the hash
262
364
 
263
365
  ```ruby
264
- { 1 => :a, a: b, [2, 3] => :c }
366
+ { a: 1, b: :a, c: [2, 3] }.transpose!
367
+
368
+ # changes hash to { 1 => :a, a: :b, [2, 3] => :c }
265
369
  ```
370
+
371
+ ### #to_deep_hash
372
+ Changes a hash spliting keys into inner hashs
373
+
374
+ ```ruby
375
+ hash = { 'a.b[0]' => 1, 'a.b[1]' => 2 }
376
+ hash.to_deep_hash
377
+
378
+ # returns { 'a' => { 'b' => 1 } }
379
+ ```
380
+
381
+ ### #to_deep_hash!
382
+ Changes a hash spliting keys into inner hashs
383
+
384
+ ```ruby
385
+ hash = { 'a.b[0]' => 1, 'a.b[1]' => 2 }
386
+ hash.to_deep_hash!
387
+
388
+ # changes hash to { 'a' => { 'b' => 1 } }
389
+ ```
390
+
391
+ ## Added by Enumerable
392
+ - [#clean](ENUMERABLE_README.md#clean)
393
+ - [#clean!](ENUMERABLE_README.md#clean!)
394
+ - [#map_and_find](ENUMERABLE_README.md#map_and_find)
395
+ - [#map_and_select](ENUMERABLE_README.md#map_and_select)
396
+ - [#map_to_hash](ENUMERABLE_README.md#map_to_hash)
397
+
398
+ ## Added by Object
399
+ - [#is_any?](OBJECT_README.md#is_any?)
400
+ - [#trueful?](OBJECT_README.md#trueful?)
401
+
402
+ ## Added by Class
403
+ - [.default_value](CLASS_README.md#default_value)
404
+ - [.default_values](CLASS_README.md#default_values)
405
+ - [.default_reader](CLASS_README.md#default_reader)
406
+ - [.default_readers](CLASS_README.md#default_readers)