refinements 2.2.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +58 -41
- data/lib/refinements/{array_extensions.rb → arrays.rb} +1 -1
- data/lib/refinements/{big_decimal_extensions.rb → big_decimals.rb} +1 -1
- data/lib/refinements/{hash_extensions.rb → hashes.rb} +6 -1
- data/lib/refinements/identity.rb +1 -1
- data/lib/refinements/strings.rb +72 -0
- data/lib/tasks/rspec.rake +2 -0
- data/lib/tasks/rubocop.rake +2 -0
- metadata +66 -109
- metadata.gz.sig +0 -0
- data/lib/refinements/string_extensions.rb +0 -21
- data/lib/tasks/console.rake +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3892f7956e4d8cfc57a1872c6c13509c569fbac
|
4
|
+
data.tar.gz: b36a0d0ad57850bfbb554b40ff0606b6c48fe522
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 327582d5686e68f62be1b48e267a30e3ee13befeefcc4082be3692083098ed273b2f5ed3aba570f625395824ced13641b00ba4e2ac87e9ce9add80fc01ad8436
|
7
|
+
data.tar.gz: a38b3a142c34986ed08f3ac085c56c330aabe3159290d592cb2af06114cef3211b2f9d327832acff10e0acd17c147bcf078655bc707047935561a3d629a06f1e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
[![Travis CI Status](https://secure.travis-ci.org/bkuhlmann/refinements.svg)](https://travis-ci.org/bkuhlmann/refinements)
|
8
8
|
[![Patreon](https://img.shields.io/badge/patreon-donate-brightgreen.svg)](https://www.patreon.com/bkuhlmann)
|
9
9
|
|
10
|
-
Provides a collection of refinements
|
10
|
+
Provides a collection of refinements to core Ruby objects.
|
11
11
|
|
12
12
|
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
13
13
|
|
@@ -36,26 +36,30 @@ Provides a collection of refinements for core Ruby objects.
|
|
36
36
|
|
37
37
|
# Features
|
38
38
|
|
39
|
-
-
|
39
|
+
- Provides Array refinements:
|
40
|
+
- `Array#compress` - Removes `nil` and empty values without modifying itself.
|
41
|
+
- `Array#compress!` - Removes `nil` and empty values while modifying itself.
|
42
|
+
- Provides BigDecimal refinements:
|
40
43
|
- `BigDecimal#inspect` - Allows one to inspect a big decimal with numeric representation.
|
41
|
-
-
|
42
|
-
- `
|
43
|
-
-
|
44
|
-
-
|
45
|
-
- `#
|
46
|
-
- `#compact!` - Removes key/value pairs with nil values and modifies itself.
|
47
|
-
- `#deep_merge` - Merges deeply nested hashes together without itself.
|
48
|
-
- `#deep_merge!` - Merges deeply nested hashes together and modifies itself.
|
44
|
+
- Provides Hash refinements:
|
45
|
+
- `#compact` - Removes key/value pairs with `nil` values without modifying itself.
|
46
|
+
- `#compact!` - Removes key/value pairs with `nil` values while modifying itself.
|
47
|
+
- `#deep_merge` - Merges deeply nested hashes together without modifying itself.
|
48
|
+
- `#deep_merge!` - Merges deeply nested hashes together while modifying itself.
|
49
49
|
- `#reverse_merge` - Merges calling hash into passed in hash without modifying calling hash.
|
50
|
-
- `#reverse_merge!` - Merges calling hash into passed in hash
|
51
|
-
-
|
50
|
+
- `#reverse_merge!` - Merges calling hash into passed in hash while modifying calling hash.
|
51
|
+
- Provides String refinements:
|
52
|
+
- `#blank?` - Answers `true`/`false` based on whether string is blank
|
53
|
+
or not (i.e. `<space>`, `\n`, `\t`, `\r`).
|
54
|
+
- `#up` - Answers string with only first letter upcased.
|
55
|
+
- `#down` - Answers string with only first letter downcased.
|
52
56
|
- `#camelcase` - Answers a camelcased string. Example: "ThisIsCamelcase".
|
53
57
|
- `#snakecase` - Answers a snakecased string. Example: "this_is_snakecase".
|
54
58
|
- `#titleize` - Answers titleized string. Example: "This Is Titleized".
|
55
59
|
|
56
60
|
# Requirements
|
57
61
|
|
58
|
-
0. [
|
62
|
+
0. [Ruby 2.3.x](https://www.ruby-lang.org).
|
59
63
|
0. A solid understanding of [Ruby refinements and lexical scope](https://www.youtube.com/watch?v=qXC9Gk4dCEw).
|
60
64
|
|
61
65
|
# Setup
|
@@ -65,8 +69,9 @@ For a secure install, type the following from the command line (recommended):
|
|
65
69
|
gem cert --add <(curl --location --silent https://www.alchemists.io/gem-public.pem)
|
66
70
|
gem install refinements --trust-policy MediumSecurity
|
67
71
|
|
68
|
-
NOTE: A HighSecurity trust policy would be best but MediumSecurity enables signed gem verification
|
69
|
-
allowing the installation of unsigned dependencies since they are beyond the scope of this
|
72
|
+
NOTE: A HighSecurity trust policy would be best but MediumSecurity enables signed gem verification
|
73
|
+
while allowing the installation of unsigned dependencies since they are beyond the scope of this
|
74
|
+
gem.
|
70
75
|
|
71
76
|
For an insecure install, type the following (not recommended):
|
72
77
|
|
@@ -80,38 +85,41 @@ Add the following to your Gemfile file:
|
|
80
85
|
|
81
86
|
## Requires
|
82
87
|
|
83
|
-
Due to this gem being a collection of Ruby refinements, none of the refinements are auto-loaded by
|
84
|
-
|
85
|
-
require one or all of the following:
|
88
|
+
Due to this gem being a collection of Ruby refinements, none of the refinements are auto-loaded by
|
89
|
+
default in order to reduce application bloat. Instead, require the specific requirement for the code
|
90
|
+
that needs it. You'll want to require one or all of the following:
|
86
91
|
|
87
|
-
require "refinements/
|
88
|
-
require "refinements/
|
89
|
-
require "refinements/
|
90
|
-
require "refinements/
|
92
|
+
require "refinements/arrays"
|
93
|
+
require "refinements/big_decimals"
|
94
|
+
require "refinements/hashes"
|
95
|
+
require "refinements/strings"
|
91
96
|
|
92
97
|
## Using
|
93
98
|
|
94
|
-
In addition to requiring the appropriate refinement
|
95
|
-
refinement by using the `using` keyword within your object. You'll want to use one or all of
|
99
|
+
In addition to requiring the appropriate refinement for the code that needs it, you'll also need to
|
100
|
+
use the refinement by using the `using` keyword within your object. You'll want to use one or all of
|
101
|
+
the following:
|
96
102
|
|
97
103
|
class Example
|
98
|
-
using Refinements::
|
99
|
-
using Refinements::
|
100
|
-
using Refinements::
|
101
|
-
using Refinements::
|
104
|
+
using Refinements::Arrays
|
105
|
+
using Refinements::BigDecimals
|
106
|
+
using Refinements::Hashes
|
107
|
+
using Refinements::Strings
|
102
108
|
end
|
103
109
|
|
104
110
|
## Examples
|
105
111
|
|
106
|
-
With the appropriate refinements required and used within your objects, the following sections
|
107
|
-
refinement enriches your objects with new capabilities.
|
112
|
+
With the appropriate refinements required and used within your objects, the following sections
|
113
|
+
demonstrate how each refinement enriches your objects with new capabilities.
|
108
114
|
|
109
115
|
### String
|
110
116
|
|
111
|
-
|
112
|
-
example.
|
113
|
-
|
114
|
-
|
117
|
+
" \n\t\r".blank? # => true
|
118
|
+
"example".up # => "Example"
|
119
|
+
"EXAMPLE".down # => "eXAMPLE"
|
120
|
+
"this_is_an_example".camelcase # => "ThisIsAnExample"
|
121
|
+
"ThisIsAnExample".snakecase # => "this_is_an_example"
|
122
|
+
"ThisIsAnExample".titleize # => "This Is An Example"
|
115
123
|
|
116
124
|
### Big Decimal
|
117
125
|
|
@@ -130,6 +138,14 @@ refinement enriches your objects with new capabilities.
|
|
130
138
|
|
131
139
|
### Hash
|
132
140
|
|
141
|
+
example = {a: 1, b: nil}
|
142
|
+
example.compact # => {a: 1}
|
143
|
+
example # => {a: 1, b: nil}
|
144
|
+
|
145
|
+
example = {a: 1, b: nil}
|
146
|
+
example.compact! # => {a: 1}
|
147
|
+
example # => {a: 1}
|
148
|
+
|
133
149
|
example = {a: "A", b: {one: "One", two: "Two"}}
|
134
150
|
example.deep_merge b: {one: 1} # => {a: "A", b: {one: 1, two: "Two"}}
|
135
151
|
example # => {a: "A", b: {one: "One", two: "Two"}}
|
@@ -156,14 +172,14 @@ To test, run:
|
|
156
172
|
|
157
173
|
Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
|
158
174
|
|
159
|
-
- Patch (x.y.Z) - Incremented for small, backwards compatible bug fixes.
|
160
|
-
- Minor (x.Y.z) - Incremented for new, backwards compatible public API enhancements
|
175
|
+
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
176
|
+
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
161
177
|
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
162
178
|
|
163
179
|
# Code of Conduct
|
164
180
|
|
165
|
-
Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
|
166
|
-
you agree to abide by its terms.
|
181
|
+
Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
|
182
|
+
participating in this project you agree to abide by its terms.
|
167
183
|
|
168
184
|
# Contributions
|
169
185
|
|
@@ -172,13 +188,14 @@ Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
|
172
188
|
# License
|
173
189
|
|
174
190
|
Copyright (c) 2015 [Alchemists](https://www.alchemists.io).
|
175
|
-
Read
|
191
|
+
Read [LICENSE](LICENSE.md) for details.
|
176
192
|
|
177
193
|
# History
|
178
194
|
|
179
|
-
Read
|
195
|
+
Read [CHANGES](CHANGES.md) for details.
|
180
196
|
Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
|
181
197
|
|
182
198
|
# Credits
|
183
199
|
|
184
|
-
Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
|
200
|
+
Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
|
201
|
+
[Alchemists](https://www.alchemists.io).
|
@@ -2,13 +2,18 @@
|
|
2
2
|
|
3
3
|
module Refinements
|
4
4
|
# Refinements for Hashes.
|
5
|
-
module
|
5
|
+
module Hashes
|
6
|
+
# rubocop:disable Metrics/BlockLength
|
6
7
|
refine Hash do
|
8
|
+
# TODO: Remove when Ruby 2.4 is released.
|
7
9
|
def compact
|
10
|
+
puts "[DEPRECATION]: #compact is deprecated and is included, by default, in Ruby 2.4."
|
8
11
|
dup.compact!
|
9
12
|
end
|
10
13
|
|
14
|
+
# TODO: Remove when Ruby 2.4 is released.
|
11
15
|
def compact!
|
16
|
+
puts "[DEPRECATION]: #compact! is deprecated and is included, by default, in Ruby 2.4."
|
12
17
|
reject! { |_, value| value.nil? }
|
13
18
|
end
|
14
19
|
|
data/lib/refinements/identity.rb
CHANGED
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Refinements
|
4
|
+
# Refinements for Strings.
|
5
|
+
module Strings
|
6
|
+
refine String.singleton_class do
|
7
|
+
def delimiters
|
8
|
+
%r([a-z][A-Z]|\s*\-\s*|\s*\/\s*|\s*\:+\s*|\s*\_\s*|\s+)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# rubocop:disable Metrics/BlockLength
|
13
|
+
refine String do
|
14
|
+
def blank?
|
15
|
+
!match(/\A\s*\z/).nil?
|
16
|
+
end
|
17
|
+
|
18
|
+
def up
|
19
|
+
return self if empty?
|
20
|
+
self[0].upcase + self[1, size]
|
21
|
+
end
|
22
|
+
|
23
|
+
def down
|
24
|
+
return self if empty?
|
25
|
+
self[0].downcase + self[1, size]
|
26
|
+
end
|
27
|
+
|
28
|
+
def camelcase
|
29
|
+
if self =~ self.class.delimiters
|
30
|
+
result = up_and_join split(%r(\s*\-\s*|\s*\/\s*|\s*\:+\s*)), delimiter: "::"
|
31
|
+
up_and_join result.split(/\s*\_\s*|\s+/)
|
32
|
+
else
|
33
|
+
up
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def snakecase
|
38
|
+
if self =~ self.class.delimiters
|
39
|
+
result = down_and_join split(%r(\s*\-\s*|\s*\/\s*|\s*\:+\s*)), delimiter: "/"
|
40
|
+
down_and_join result.split(/(?=[A-Z])|\s*\_\s*|\s+/), delimiter: "_"
|
41
|
+
else
|
42
|
+
downcase
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def titleize
|
47
|
+
if self =~ self.class.delimiters
|
48
|
+
result = up_and_join split(/(?=[A-Z])|\s*\_\s*|\s*\-\s*|\s+/), delimiter: " "
|
49
|
+
up_and_join result.split(%r(\s*\/\s*|\s*\:+\s*)), delimiter: "/"
|
50
|
+
else
|
51
|
+
capitalize
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def up_and_join parts, delimiter: ""
|
58
|
+
parts.reduce "" do |result, part|
|
59
|
+
next part.up if result.empty?
|
60
|
+
"#{result}#{delimiter}#{part.up}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def down_and_join parts, delimiter: ""
|
65
|
+
parts.reduce "" do |result, part|
|
66
|
+
next part.down if result.empty?
|
67
|
+
"#{result}#{delimiter}#{part.down}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
data/lib/tasks/rspec.rake
CHANGED
data/lib/tasks/rubocop.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinements
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -12,25 +12,25 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMQ8wDQYDVQQDDAZicm9v
|
14
14
|
a2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQBGRYC
|
15
|
-
|
15
|
+
aW8wHhcNMTYxMDE5MTY0NDEzWhcNMTcxMDE5MTY0NDEzWjBBMQ8wDQYDVQQDDAZi
|
16
16
|
cm9va2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQB
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
GRYCaW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgryPL4/IbWDcL
|
18
|
+
fnqpnoJALqj+ega7hSsvvD8sac57HPNLeKcOmSafFiQLAnTmmE132ZlFc8kyZRVn
|
19
|
+
zmqSESowO5jd+ggFuy1ySqQJXhwgik04KedKRUjpIDZePrjw+M5UJT1qzKCKL2xI
|
20
|
+
nx5cOKP1fSWJ1RRu8JhaDeSloGtYMdw2c28wnKPNIsWDood4xhbLcY9IqeISft2e
|
21
|
+
oTAHTHandHbvt24X3/n67ceNjLBbsVZPXCC1C8C8ccjHjA4Tm2uiFoDwThMcPggg
|
22
|
+
90H6fh0vLFcNAobdPEchbge8tWtfmMPz2+C4yklANn81GA+ANsBS1uwx6mxJoMQU
|
23
|
+
BNVp0aLvAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
|
24
|
+
BBRS85Rn1BaqeIONByw4t46DMDMzHDAfBgNVHREEGDAWgRRicm9va2VAYWxjaGVt
|
25
25
|
aXN0cy5pbzAfBgNVHRIEGDAWgRRicm9va2VAYWxjaGVtaXN0cy5pbzANBgkqhkiG
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
9w0BAQUFAAOCAQEAZMb57Y4wdpbX8XxTukEO7VC1pndccUsxdbziGsAOiuHET3Aq
|
27
|
+
ygLvrfdYrN88/w+qxncW5bxbO3a6UGkuhIFUPM8zRSE/rh6bCcJljTJrExVt42eV
|
28
|
+
aYCb7WJNsx3eNXHn3uQodq3tD+lmNJzz2bFeT3smGSKEnALBjqorO/2mpDh4FJ3S
|
29
|
+
4CcDYsJ1ywep8LDJDBBGdKz9moL+axryzpeTpgTT/fFYFzRzWrURPyDvPOikh9TX
|
30
|
+
n/LUZ1dKhIHzfKx1B4+TEIefArObGfkLIDM8+Dq1RX7TF1k81Men7iu4MgE9bYBn
|
31
|
+
3dE+xI3FdB5gWcdWxdtgRCmWjtXeYYyb4z6NQQ==
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2016-
|
33
|
+
date: 2016-11-02 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rake
|
@@ -52,211 +52,169 @@ dependencies:
|
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '7.
|
55
|
+
version: '7.7'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
58
|
version_requirements: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '7.
|
62
|
+
version: '7.7'
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: pry
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
69
|
+
version: '0.10'
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "
|
74
|
+
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
76
|
+
version: '0.10'
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
78
|
name: pry-byebug
|
79
79
|
requirement: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '3.4'
|
84
84
|
type: :development
|
85
85
|
prerelease: false
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '
|
90
|
+
version: '3.4'
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: pry-state
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - "
|
95
|
+
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
97
|
+
version: '0.1'
|
98
98
|
type: :development
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- - "
|
102
|
+
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
104
|
+
version: '0.1'
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: bond
|
107
107
|
requirement: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- - "
|
109
|
+
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
111
|
+
version: '0.5'
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
114
|
version_requirements: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- - "
|
116
|
+
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
118
|
+
version: '0.5'
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: wirb
|
121
121
|
requirement: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- - "
|
123
|
+
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
125
|
+
version: '2.0'
|
126
126
|
type: :development
|
127
127
|
prerelease: false
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- - "
|
130
|
+
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: '0'
|
132
|
+
version: '2.0'
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: hirb
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - "
|
137
|
+
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: '0'
|
139
|
+
version: '0.7'
|
140
140
|
type: :development
|
141
141
|
prerelease: false
|
142
142
|
version_requirements: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- - "
|
144
|
+
- - "~>"
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: '0'
|
146
|
+
version: '0.7'
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
148
|
name: awesome_print
|
149
149
|
requirement: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- - "
|
151
|
+
- - "~>"
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version: '
|
153
|
+
version: '1.7'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
156
|
version_requirements: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
|
-
- - "
|
158
|
+
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version: '
|
160
|
+
version: '1.7'
|
161
161
|
- !ruby/object:Gem::Dependency
|
162
162
|
name: rspec
|
163
163
|
requirement: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
165
|
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version: '3.
|
167
|
+
version: '3.5'
|
168
168
|
type: :development
|
169
169
|
prerelease: false
|
170
170
|
version_requirements: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
172
|
- - "~>"
|
173
173
|
- !ruby/object:Gem::Version
|
174
|
-
version: '3.
|
175
|
-
- !ruby/object:Gem::Dependency
|
176
|
-
name: rb-fsevent
|
177
|
-
requirement: !ruby/object:Gem::Requirement
|
178
|
-
requirements:
|
179
|
-
- - ">="
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '0'
|
182
|
-
type: :development
|
183
|
-
prerelease: false
|
184
|
-
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
requirements:
|
186
|
-
- - ">="
|
187
|
-
- !ruby/object:Gem::Version
|
188
|
-
version: '0'
|
174
|
+
version: '3.5'
|
189
175
|
- !ruby/object:Gem::Dependency
|
190
176
|
name: guard-rspec
|
191
177
|
requirement: !ruby/object:Gem::Requirement
|
192
178
|
requirements:
|
193
|
-
- - "
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
version: '0'
|
196
|
-
type: :development
|
197
|
-
prerelease: false
|
198
|
-
version_requirements: !ruby/object:Gem::Requirement
|
199
|
-
requirements:
|
200
|
-
- - ">="
|
201
|
-
- !ruby/object:Gem::Version
|
202
|
-
version: '0'
|
203
|
-
- !ruby/object:Gem::Dependency
|
204
|
-
name: terminal-notifier
|
205
|
-
requirement: !ruby/object:Gem::Requirement
|
206
|
-
requirements:
|
207
|
-
- - ">="
|
208
|
-
- !ruby/object:Gem::Version
|
209
|
-
version: '0'
|
210
|
-
type: :development
|
211
|
-
prerelease: false
|
212
|
-
version_requirements: !ruby/object:Gem::Requirement
|
213
|
-
requirements:
|
214
|
-
- - ">="
|
215
|
-
- !ruby/object:Gem::Version
|
216
|
-
version: '0'
|
217
|
-
- !ruby/object:Gem::Dependency
|
218
|
-
name: terminal-notifier-guard
|
219
|
-
requirement: !ruby/object:Gem::Requirement
|
220
|
-
requirements:
|
221
|
-
- - ">="
|
179
|
+
- - "~>"
|
222
180
|
- !ruby/object:Gem::Version
|
223
|
-
version: '
|
181
|
+
version: '4.7'
|
224
182
|
type: :development
|
225
183
|
prerelease: false
|
226
184
|
version_requirements: !ruby/object:Gem::Requirement
|
227
185
|
requirements:
|
228
|
-
- - "
|
186
|
+
- - "~>"
|
229
187
|
- !ruby/object:Gem::Version
|
230
|
-
version: '
|
188
|
+
version: '4.7'
|
231
189
|
- !ruby/object:Gem::Dependency
|
232
190
|
name: rubocop
|
233
191
|
requirement: !ruby/object:Gem::Requirement
|
234
192
|
requirements:
|
235
193
|
- - "~>"
|
236
194
|
- !ruby/object:Gem::Version
|
237
|
-
version: '0.
|
195
|
+
version: '0.44'
|
238
196
|
type: :development
|
239
197
|
prerelease: false
|
240
198
|
version_requirements: !ruby/object:Gem::Requirement
|
241
199
|
requirements:
|
242
200
|
- - "~>"
|
243
201
|
- !ruby/object:Gem::Version
|
244
|
-
version: '0.
|
202
|
+
version: '0.44'
|
245
203
|
- !ruby/object:Gem::Dependency
|
246
204
|
name: codeclimate-test-reporter
|
247
205
|
requirement: !ruby/object:Gem::Requirement
|
248
206
|
requirements:
|
249
|
-
- - "
|
207
|
+
- - "~>"
|
250
208
|
- !ruby/object:Gem::Version
|
251
|
-
version: '0'
|
209
|
+
version: '0.6'
|
252
210
|
type: :development
|
253
211
|
prerelease: false
|
254
212
|
version_requirements: !ruby/object:Gem::Requirement
|
255
213
|
requirements:
|
256
|
-
- - "
|
214
|
+
- - "~>"
|
257
215
|
- !ruby/object:Gem::Version
|
258
|
-
version: '0'
|
259
|
-
description:
|
216
|
+
version: '0.6'
|
217
|
+
description:
|
260
218
|
email:
|
261
219
|
- brooke@alchemists.io
|
262
220
|
executables: []
|
@@ -268,12 +226,11 @@ files:
|
|
268
226
|
- LICENSE.md
|
269
227
|
- README.md
|
270
228
|
- lib/refinements.rb
|
271
|
-
- lib/refinements/
|
272
|
-
- lib/refinements/
|
273
|
-
- lib/refinements/
|
229
|
+
- lib/refinements/arrays.rb
|
230
|
+
- lib/refinements/big_decimals.rb
|
231
|
+
- lib/refinements/hashes.rb
|
274
232
|
- lib/refinements/identity.rb
|
275
|
-
- lib/refinements/
|
276
|
-
- lib/tasks/console.rake
|
233
|
+
- lib/refinements/strings.rb
|
277
234
|
- lib/tasks/rspec.rake
|
278
235
|
- lib/tasks/rubocop.rake
|
279
236
|
homepage: https://github.com/bkuhlmann/refinements
|
@@ -296,8 +253,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
253
|
version: '0'
|
297
254
|
requirements: []
|
298
255
|
rubyforge_project:
|
299
|
-
rubygems_version: 2.6.
|
256
|
+
rubygems_version: 2.6.8
|
300
257
|
signing_key:
|
301
258
|
specification_version: 4
|
302
|
-
summary: Provides a collection of refinements
|
259
|
+
summary: Provides a collection of refinements to core Ruby objects.
|
303
260
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Refinements
|
4
|
-
# Refinements for Strings.
|
5
|
-
module StringExtensions
|
6
|
-
refine String do
|
7
|
-
def camelcase
|
8
|
-
return self if self =~ /\A\w+\z/ && self =~ /[A-Z]/ && self =~ /[a-z]/
|
9
|
-
snakecase.split("_").map(&:capitalize).join ""
|
10
|
-
end
|
11
|
-
|
12
|
-
def snakecase
|
13
|
-
downcase.gsub(/[^a-z]/, "_").squeeze "_"
|
14
|
-
end
|
15
|
-
|
16
|
-
def titleize
|
17
|
-
snakecase.split("_").map(&:capitalize).join " "
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|