gorilla-patch 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e86f0a18b202f65421f816dec4cc4681716107ea
4
+ data.tar.gz: e8e192ab64c145cf72ac39d13c21c8ebc84f13ec
5
+ SHA512:
6
+ metadata.gz: 993f5953b88edc8b5ccc62172390de0c3bd58fbc9b3edd9be942728cd9999be0c2142083127197275341c59911dae2af66b81fcdbff53de9c8af81807c6677e7
7
+ data.tar.gz: b63725eefee76e849d548497aed4e8ab6653966b31f9e02fb1de6cc9e78a83525a2d42a19b02903c2794138a50bf2f14c1f8054507d77d5b471cc1e31f762b87
@@ -0,0 +1 @@
1
+ Dir.glob(File.join(__dir__, 'gorilla-patch', '*.rb')).each {|file| require file }
@@ -0,0 +1,19 @@
1
+ module GorillaPatch
2
+ module ArrayExt
3
+
4
+ refine Array do
5
+
6
+ def compare(other)
7
+ other = [other] unless other.kind_of?(Array)
8
+ sort == other.sort
9
+ end
10
+
11
+ def include_any?(*items)
12
+ items = items.first if items.length == 1 && items.first.kind_of?(Array)
13
+ !(self & items).empty?
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ module GorillaPatch
2
+ module HashExt
3
+
4
+ refine Hash do
5
+
6
+ def to_sym_keys
7
+ inject({}) { | hash_sym, (key, val) | hash_sym[key.to_sym] = val; hash_sym }
8
+ end
9
+
10
+ def to_sym_keys!
11
+ hash_sym = to_sym_keys
12
+ self.clear.merge! hash_sym
13
+ end
14
+
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ module GorillaPatch
2
+ module ModuleExt
3
+
4
+ refine Module do
5
+
6
+ def demodulize
7
+ to_s.split('::').last
8
+ end
9
+
10
+ end
11
+
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gorilla-patch
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alexander Popov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-26 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Refine Ruby Core classes.
14
+ email: alex.wayfer@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/gorilla-patch.rb
20
+ - lib/gorilla-patch/array.rb
21
+ - lib/gorilla-patch/hash.rb
22
+ - lib/gorilla-patch/module.rb
23
+ homepage: https://bitbucket.org/AlexWayfer/gorilla-patch
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.4.5
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Monkey patch, Core extensions
47
+ test_files: []