gorilla-patch 2.1.2 → 2.2.1
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 +4 -4
- data/lib/gorilla-patch.rb +0 -2
- data/lib/gorilla-patch/blank.rb +0 -2
- data/lib/gorilla-patch/compact.rb +0 -2
- data/lib/gorilla-patch/cover.rb +0 -2
- data/lib/gorilla-patch/deep_dup.rb +0 -2
- data/lib/gorilla-patch/deep_merge.rb +33 -0
- data/lib/gorilla-patch/except.rb +0 -2
- data/lib/gorilla-patch/inflections.rb +0 -2
- data/lib/gorilla-patch/keys.rb +0 -2
- data/lib/gorilla-patch/namespace.rb +3 -7
- data/lib/gorilla-patch/slice.rb +0 -2
- data/lib/gorilla-patch/symbolize.rb +0 -2
- data/lib/gorilla-patch/truncate.rb +0 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f2d2ea928c8b7555ede0e40a74318ef2f4c976e
|
4
|
+
data.tar.gz: 0be9453981f83324853200d3b78c3c8774c7c26f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3592067dfabeb4f8484ae1567f4ea60210f7641e499767bd4eafb15cd448fed3a84e2fa6c4a328bbfc5b5a6455db6c0ee699ba9837855f0aee0ca6e06a33aa8
|
7
|
+
data.tar.gz: 2181e90dd2d46872049d0b81a1ff72ef4e5ee77358ea1c9b357acff6660fce437e2262b0ec1cfe977af3dead5f55fcce36b8e5f7ffe13ea55fe6e260f773a81d
|
data/lib/gorilla-patch.rb
CHANGED
data/lib/gorilla-patch/blank.rb
CHANGED
data/lib/gorilla-patch/cover.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
module GorillaPatch
|
2
|
+
## Adding deep_merge method
|
3
|
+
module DeepMerge
|
4
|
+
refine Hash do
|
5
|
+
def deep_merge!(other_hash, &block)
|
6
|
+
other_hash.each do |other_key, other_value|
|
7
|
+
self_value = self[other_key]
|
8
|
+
|
9
|
+
deep_value_merge!(other_key, self_value, other_value, &block)
|
10
|
+
end
|
11
|
+
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def deep_merge(other_hash, &block)
|
16
|
+
dup.deep_merge!(other_hash, &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def deep_value_merge!(other_key, self_value, other_value, &block)
|
22
|
+
self[other_key] =
|
23
|
+
if self_value.is_a?(Hash) && other_value.is_a?(Hash)
|
24
|
+
self_value.deep_merge(other_value, &block)
|
25
|
+
elsif block_given? && key?(other_key)
|
26
|
+
yield(other_key, self_value, other_value)
|
27
|
+
else
|
28
|
+
other_value
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/gorilla-patch/except.rb
CHANGED
data/lib/gorilla-patch/keys.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
module GorillaPatch
|
4
2
|
## Adding namespaces-changing methods
|
5
3
|
module Namespace
|
@@ -9,11 +7,9 @@ module GorillaPatch
|
|
9
7
|
end
|
10
8
|
end
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
to_s.demodulize
|
16
|
-
end
|
10
|
+
refine Module do
|
11
|
+
def demodulize
|
12
|
+
to_s.demodulize
|
17
13
|
end
|
18
14
|
end
|
19
15
|
end
|
data/lib/gorilla-patch/slice.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gorilla-patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Popov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/gorilla-patch/compact.rb
|
120
120
|
- lib/gorilla-patch/cover.rb
|
121
121
|
- lib/gorilla-patch/deep_dup.rb
|
122
|
+
- lib/gorilla-patch/deep_merge.rb
|
122
123
|
- lib/gorilla-patch/except.rb
|
123
124
|
- lib/gorilla-patch/inflections.rb
|
124
125
|
- lib/gorilla-patch/keys.rb
|
@@ -146,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
147
|
version: '0'
|
147
148
|
requirements: []
|
148
149
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.6.
|
150
|
+
rubygems_version: 2.6.11
|
150
151
|
signing_key:
|
151
152
|
specification_version: 4
|
152
153
|
summary: Refining core classes
|