gorilla-patch 0.0.5 → 0.0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gorilla-patch.rb +1 -1
- data/lib/gorilla-patch/array.rb +4 -7
- data/lib/gorilla-patch/hash.rb +1 -4
- data/lib/gorilla-patch/module.rb +2 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a6bd3204e90b32d250478b7f8880597764e7c1b
|
4
|
+
data.tar.gz: 04cced732349ccb3060ebdc759a73d30fec56d8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9db408bc51258110ce23614ea3d946254f9246d3b5263736ad8edee339c52ed96abe544d8afcd56808295a4be79adb5c4c42cf1033329d06af7dc693a0ac46b
|
7
|
+
data.tar.gz: c5902024b571965b812cbb125fb0d7f9782838c5dd4264bdbce7fff0e4e4359dc3233e26cdb48f9abaccece5a604ea4a763a2c19a6990202b6bfd2506aa636fa
|
data/lib/gorilla-patch.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Dir.glob(File.join(__dir__, 'gorilla-patch', '*.rb')).each {|file| require file }
|
1
|
+
Dir.glob(File.join(__dir__, 'gorilla-patch', '*.rb')).each { |file| require file }
|
data/lib/gorilla-patch/array.rb
CHANGED
@@ -1,19 +1,16 @@
|
|
1
1
|
module GorillaPatch
|
2
|
+
## Refine Array class
|
2
3
|
module ArrayExt
|
3
|
-
|
4
4
|
refine Array do
|
5
|
-
|
6
5
|
def compare(other)
|
7
|
-
other = [other] unless other.
|
6
|
+
other = [other] unless other.is_a?(Array)
|
8
7
|
sort == other.sort
|
9
8
|
end
|
10
9
|
|
11
10
|
def include_any?(*items)
|
12
|
-
items = items.first if items.length == 1 && items.first.
|
11
|
+
items = items.first if items.length == 1 && items.first.is_a?(Array)
|
13
12
|
!(self & items).empty?
|
14
13
|
end
|
15
|
-
|
16
14
|
end
|
17
|
-
|
18
15
|
end
|
19
|
-
end
|
16
|
+
end
|
data/lib/gorilla-patch/hash.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
module GorillaPatch
|
2
|
+
## Refine Hash class
|
2
3
|
module HashExt
|
3
|
-
|
4
4
|
refine Hash do
|
5
|
-
|
6
5
|
def keys_to_sym
|
7
6
|
each_with_object({}) { |(key, val), hash_sym| hash_sym[key.to_sym] = val }
|
8
7
|
end
|
@@ -37,8 +36,6 @@ module GorillaPatch
|
|
37
36
|
def compact!
|
38
37
|
delete_if { |_k, v| v.nil? }
|
39
38
|
end
|
40
|
-
|
41
39
|
end
|
42
|
-
|
43
40
|
end
|
44
41
|
end
|
data/lib/gorilla-patch/module.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: 0.0.5
|
4
|
+
version: 0.0.5.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: 2015-09-
|
11
|
+
date: 2015-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Refine Ruby Core classes.
|
14
14
|
email: alex.wayfer@gmail.com
|