gorilla-patch 1.0.2 → 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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 274828f8549d1ba6f48b9b4a7df6ec071f4b70ae
|
4
|
+
data.tar.gz: 510f3668fe0f0e1b13e57273d50deb27062da560
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ca217c29f927eeb7c0f985c68223941103cf8163957798fe9cf043c32f1b9ecf81818cab7c3bffc713f895bd78f55c991561928f955b52f98d64d496d76b0b7
|
7
|
+
data.tar.gz: 02b0bdf545ff67c49230a87b435df69ea4d7a5f7515e6018a0c8ea3ac3e92c9810e2ff5c206b89fbc05e96025d3258d09a3a9a7c16620c60eb7334bdf83f5c62
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module GorillaPatch
|
2
|
+
## Inflections
|
3
|
+
module Inflections
|
4
|
+
refine String do
|
5
|
+
def underscore
|
6
|
+
gsub(/::/, '/')
|
7
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
8
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
9
|
+
.tr('-', '_')
|
10
|
+
.downcase
|
11
|
+
end
|
12
|
+
|
13
|
+
def camelize
|
14
|
+
split('/')
|
15
|
+
.map do |s|
|
16
|
+
s.split(/([[:upper:]][[:lower:]]*)|_|-/).collect(&:capitalize).join
|
17
|
+
end
|
18
|
+
.join('::')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
refine Module do
|
23
|
+
def underscore
|
24
|
+
to_s.underscore
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.from_sequel
|
29
|
+
@from_sequel ||= Module.new do
|
30
|
+
require 'sequel'
|
31
|
+
|
32
|
+
refine String do
|
33
|
+
Sequel::Inflections.private_instance_methods.each do |method|
|
34
|
+
define_method method do
|
35
|
+
Sequel::Inflections.instance_method(method).bind(self).call(self)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.from_inflecto
|
43
|
+
require 'inflecto-refinements'
|
44
|
+
|
45
|
+
Inflecto::Refinements
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -1,16 +1,44 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gorilla-patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Popov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
11
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Refine Ruby Core classes with methods like Active Support.
|
14
42
|
email: alex.wayfer@gmail.com
|
15
43
|
executables: []
|
16
44
|
extensions: []
|
@@ -19,13 +47,12 @@ files:
|
|
19
47
|
- lib/gorilla-patch.rb
|
20
48
|
- lib/gorilla-patch/blank.rb
|
21
49
|
- lib/gorilla-patch/compact.rb
|
50
|
+
- lib/gorilla-patch/cover.rb
|
22
51
|
- lib/gorilla-patch/deep_dup.rb
|
23
52
|
- lib/gorilla-patch/except.rb
|
24
|
-
- lib/gorilla-patch/
|
53
|
+
- lib/gorilla-patch/inflections.rb
|
25
54
|
- lib/gorilla-patch/keys.rb
|
26
|
-
- lib/gorilla-patch/letters_case.rb
|
27
55
|
- lib/gorilla-patch/namespace.rb
|
28
|
-
- lib/gorilla-patch/quantity.rb
|
29
56
|
- lib/gorilla-patch/slice.rb
|
30
57
|
- lib/gorilla-patch/symbolize.rb
|
31
58
|
homepage: https://github.com/AlexWayfer/gorilla-patch
|
@@ -48,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
75
|
version: '0'
|
49
76
|
requirements: []
|
50
77
|
rubyforge_project:
|
51
|
-
rubygems_version: 2.
|
78
|
+
rubygems_version: 2.6.8
|
52
79
|
signing_key:
|
53
80
|
specification_version: 4
|
54
|
-
summary:
|
81
|
+
summary: Refining core classes
|
55
82
|
test_files: []
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module GorillaPatch
|
2
|
-
## Adding case-changing methods
|
3
|
-
module LettersCase
|
4
|
-
refine String do
|
5
|
-
def underscore
|
6
|
-
gsub(/::/, '/')
|
7
|
-
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
8
|
-
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
9
|
-
.tr('-', '_')
|
10
|
-
.downcase
|
11
|
-
end
|
12
|
-
|
13
|
-
def camelize
|
14
|
-
split('/')
|
15
|
-
.map do |s|
|
16
|
-
s.split(/([[:upper:]][[:lower:]]+)|_/).collect(&:capitalize).join
|
17
|
-
end
|
18
|
-
.join('::')
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
refine Module do
|
23
|
-
def underscore
|
24
|
-
to_s.underscore
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module GorillaPatch
|
2
|
-
## Refine String class by Sequel Inflections
|
3
|
-
module Quantity
|
4
|
-
def self.from_sequel
|
5
|
-
@from_sequel ||= Module.new do
|
6
|
-
require 'sequel'
|
7
|
-
|
8
|
-
refine String do
|
9
|
-
Sequel::Inflections.private_instance_methods.each do |method|
|
10
|
-
define_method method do
|
11
|
-
Sequel::Inflections.instance_method(method).bind(self).call(self)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|