refinements 5.2.0 → 6.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 +3 -12
- data/lib/refinements.rb +0 -1
- data/lib/refinements/hashes.rb +0 -2
- data/lib/refinements/identity.rb +1 -1
- data/lib/refinements/strings.rb +3 -2
- metadata +34 -50
- metadata.gz.sig +0 -0
- data/lib/refinements/objects.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 848fd21ba0d757fdc5f6fdb34181dddb369996c92ff926e2c073fa2fb8d66f7c
|
4
|
+
data.tar.gz: 5f14c9972c61c6110cbcac3f02dae114285be4f57699c0dbaf2ba48a8cd17032
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ba0796a94c1d6249b92f265d7dfb2abad08ac0552a12e6476b8dda3cd43e642f1edc78671be2cb4aa19653b3b5232a08778427142a6f44b1121e1fe87074cf5
|
7
|
+
data.tar.gz: c5e511aaf42ca87dbf10b541ada6dcfde7f3e2422e89aca2e963b04fe8a6125c86c0d0751f673f651d16402b09f3d08f2ef280d41a5c7460c05f02c101714bbc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -21,7 +21,6 @@ Provides additional enhancements (refinements) to core Ruby objects.
|
|
21
21
|
- [Array](#array)
|
22
22
|
- [Big Decimal](#big-decimal)
|
23
23
|
- [Hash](#hash)
|
24
|
-
- [Object](#object)
|
25
24
|
- [String](#string)
|
26
25
|
- [Tests](#tests)
|
27
26
|
- [Versioning](#versioning)
|
@@ -49,8 +48,6 @@ Provides additional enhancements (refinements) to core Ruby objects.
|
|
49
48
|
- `#deep_merge!` - Merges deeply nested hashes together while modifying itself.
|
50
49
|
- `#reverse_merge` - Merges calling hash into passed in hash without modifying calling hash.
|
51
50
|
- `#reverse_merge!` - Merges calling hash into passed in hash while modifying calling hash.
|
52
|
-
- Provides Object refinements:
|
53
|
-
- `#then` - Provides an alias to `yield_self` that is shorter to type.
|
54
51
|
- Provides String refinements:
|
55
52
|
- `#first` - Answers first character of a string or first set of characters if given a number.
|
56
53
|
- `#last` - Answers last character of a string or last set of characters if given a number.
|
@@ -66,8 +63,8 @@ Provides additional enhancements (refinements) to core Ruby objects.
|
|
66
63
|
|
67
64
|
## Requirements
|
68
65
|
|
69
|
-
|
70
|
-
|
66
|
+
1. [Ruby 2.6.x](https://www.ruby-lang.org).
|
67
|
+
1. A solid understanding of [Ruby refinements and lexical scope](https://www.youtube.com/watch?v=qXC9Gk4dCEw).
|
71
68
|
|
72
69
|
## Setup
|
73
70
|
|
@@ -171,12 +168,6 @@ The following sections demonstrate how each refinement enriches your objects wit
|
|
171
168
|
example = {unit: "221B", street: "Baker Street", city: "London", country: "UK"}
|
172
169
|
example.use { |unit, street| "#{unit} #{street}" } # => "221B Baker Street"
|
173
170
|
|
174
|
-
#### Object
|
175
|
-
|
176
|
-
# Contrived for simplicity.
|
177
|
-
example = "example"
|
178
|
-
example.then(&:capitalize) # "Example"
|
179
|
-
|
180
171
|
#### String
|
181
172
|
|
182
173
|
"example".first # => "e"
|
@@ -200,7 +191,7 @@ To test, run:
|
|
200
191
|
|
201
192
|
## Versioning
|
202
193
|
|
203
|
-
Read [Semantic Versioning](
|
194
|
+
Read [Semantic Versioning](https://semver.org) for details. Briefly, it means:
|
204
195
|
|
205
196
|
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
206
197
|
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
data/lib/refinements.rb
CHANGED
data/lib/refinements/hashes.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
module Refinements
|
4
4
|
# Refinements for hashes.
|
5
5
|
module Hashes
|
6
|
-
# rubocop:disable Metrics/BlockLength
|
7
6
|
refine Hash do
|
8
7
|
def except *keys
|
9
8
|
reject { |key, _value| keys.include? key }
|
@@ -52,6 +51,5 @@ module Refinements
|
|
52
51
|
yield values
|
53
52
|
end
|
54
53
|
end
|
55
|
-
# rubocop:enable Metrics/BlockLength
|
56
54
|
end
|
57
55
|
end
|
data/lib/refinements/identity.rb
CHANGED
data/lib/refinements/strings.rb
CHANGED
@@ -9,7 +9,6 @@ module Refinements
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
# rubocop:disable Metrics/BlockLength
|
13
12
|
refine String do
|
14
13
|
def first number = 0
|
15
14
|
return self if empty?
|
@@ -41,11 +40,13 @@ module Refinements
|
|
41
40
|
|
42
41
|
def up
|
43
42
|
return self if empty?
|
43
|
+
|
44
44
|
first.upcase + self[1, size]
|
45
45
|
end
|
46
46
|
|
47
47
|
def down
|
48
48
|
return self if empty?
|
49
|
+
|
49
50
|
first.downcase + self[1, size]
|
50
51
|
end
|
51
52
|
|
@@ -83,10 +84,10 @@ module Refinements
|
|
83
84
|
def join_parts parts, method:, delimiter: ""
|
84
85
|
parts.reduce "" do |result, part|
|
85
86
|
next part.__send__(method) if result.empty?
|
87
|
+
|
86
88
|
"#{result}#{delimiter}#{part.__send__ method}"
|
87
89
|
end
|
88
90
|
end
|
89
91
|
end
|
90
|
-
# rubocop:enable Metrics/BlockLength
|
91
92
|
end
|
92
93
|
end
|
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: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
4Zrsxi713z6sndd9JBAm4G7mJiV93MsuCM5N4ZDY7XaxIhvctNSNhX/Yn8LLdtGI
|
30
30
|
b4jw5t40FKyNUvLPPXYAvQALBtk=
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
32
|
+
date: 2019-01-01 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: awesome_print
|
@@ -74,159 +74,145 @@ dependencies:
|
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0.6'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
78
|
-
requirement: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.0'
|
83
|
-
type: :development
|
84
|
-
prerelease: false
|
85
|
-
version_requirements: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '1.0'
|
90
|
-
- !ruby/object:Gem::Dependency
|
91
|
-
name: gemsmith
|
77
|
+
name: guard-rspec
|
92
78
|
requirement: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
82
|
+
version: '4.7'
|
97
83
|
type: :development
|
98
84
|
prerelease: false
|
99
85
|
version_requirements: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - "~>"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
89
|
+
version: '4.7'
|
104
90
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
91
|
+
name: hirb
|
106
92
|
requirement: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
94
|
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
96
|
+
version: '0.7'
|
111
97
|
type: :development
|
112
98
|
prerelease: false
|
113
99
|
version_requirements: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
103
|
+
version: '0.7'
|
118
104
|
- !ruby/object:Gem::Dependency
|
119
|
-
name:
|
105
|
+
name: pry
|
120
106
|
requirement: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
108
|
- - "~>"
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
110
|
+
version: '0.10'
|
125
111
|
type: :development
|
126
112
|
prerelease: false
|
127
113
|
version_requirements: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
115
|
- - "~>"
|
130
116
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
117
|
+
version: '0.10'
|
132
118
|
- !ruby/object:Gem::Dependency
|
133
|
-
name:
|
119
|
+
name: pry-byebug
|
134
120
|
requirement: !ruby/object:Gem::Requirement
|
135
121
|
requirements:
|
136
122
|
- - "~>"
|
137
123
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
124
|
+
version: '3.5'
|
139
125
|
type: :development
|
140
126
|
prerelease: false
|
141
127
|
version_requirements: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
129
|
- - "~>"
|
144
130
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
131
|
+
version: '3.5'
|
146
132
|
- !ruby/object:Gem::Dependency
|
147
|
-
name:
|
133
|
+
name: rake
|
148
134
|
requirement: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
136
|
- - "~>"
|
151
137
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
138
|
+
version: '12.3'
|
153
139
|
type: :development
|
154
140
|
prerelease: false
|
155
141
|
version_requirements: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
143
|
- - "~>"
|
158
144
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
145
|
+
version: '12.3'
|
160
146
|
- !ruby/object:Gem::Dependency
|
161
|
-
name:
|
147
|
+
name: reek
|
162
148
|
requirement: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
150
|
- - "~>"
|
165
151
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
152
|
+
version: '5.0'
|
167
153
|
type: :development
|
168
154
|
prerelease: false
|
169
155
|
version_requirements: !ruby/object:Gem::Requirement
|
170
156
|
requirements:
|
171
157
|
- - "~>"
|
172
158
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
159
|
+
version: '5.0'
|
174
160
|
- !ruby/object:Gem::Dependency
|
175
|
-
name:
|
161
|
+
name: rspec
|
176
162
|
requirement: !ruby/object:Gem::Requirement
|
177
163
|
requirements:
|
178
164
|
- - "~>"
|
179
165
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
166
|
+
version: '3.8'
|
181
167
|
type: :development
|
182
168
|
prerelease: false
|
183
169
|
version_requirements: !ruby/object:Gem::Requirement
|
184
170
|
requirements:
|
185
171
|
- - "~>"
|
186
172
|
- !ruby/object:Gem::Version
|
187
|
-
version: '
|
173
|
+
version: '3.8'
|
188
174
|
- !ruby/object:Gem::Dependency
|
189
|
-
name:
|
175
|
+
name: rubocop
|
190
176
|
requirement: !ruby/object:Gem::Requirement
|
191
177
|
requirements:
|
192
178
|
- - "~>"
|
193
179
|
- !ruby/object:Gem::Version
|
194
|
-
version: '
|
180
|
+
version: '0.62'
|
195
181
|
type: :development
|
196
182
|
prerelease: false
|
197
183
|
version_requirements: !ruby/object:Gem::Requirement
|
198
184
|
requirements:
|
199
185
|
- - "~>"
|
200
186
|
- !ruby/object:Gem::Version
|
201
|
-
version: '
|
187
|
+
version: '0.62'
|
202
188
|
- !ruby/object:Gem::Dependency
|
203
|
-
name: rspec
|
189
|
+
name: rubocop-rspec
|
204
190
|
requirement: !ruby/object:Gem::Requirement
|
205
191
|
requirements:
|
206
192
|
- - "~>"
|
207
193
|
- !ruby/object:Gem::Version
|
208
|
-
version: '
|
194
|
+
version: '1.30'
|
209
195
|
type: :development
|
210
196
|
prerelease: false
|
211
197
|
version_requirements: !ruby/object:Gem::Requirement
|
212
198
|
requirements:
|
213
199
|
- - "~>"
|
214
200
|
- !ruby/object:Gem::Version
|
215
|
-
version: '
|
201
|
+
version: '1.30'
|
216
202
|
- !ruby/object:Gem::Dependency
|
217
|
-
name:
|
203
|
+
name: simplecov
|
218
204
|
requirement: !ruby/object:Gem::Requirement
|
219
205
|
requirements:
|
220
206
|
- - "~>"
|
221
207
|
- !ruby/object:Gem::Version
|
222
|
-
version: '0.
|
208
|
+
version: '0.13'
|
223
209
|
type: :development
|
224
210
|
prerelease: false
|
225
211
|
version_requirements: !ruby/object:Gem::Requirement
|
226
212
|
requirements:
|
227
213
|
- - "~>"
|
228
214
|
- !ruby/object:Gem::Version
|
229
|
-
version: '0.
|
215
|
+
version: '0.13'
|
230
216
|
- !ruby/object:Gem::Dependency
|
231
217
|
name: wirb
|
232
218
|
requirement: !ruby/object:Gem::Requirement
|
@@ -257,7 +243,6 @@ files:
|
|
257
243
|
- lib/refinements/big_decimals.rb
|
258
244
|
- lib/refinements/hashes.rb
|
259
245
|
- lib/refinements/identity.rb
|
260
|
-
- lib/refinements/objects.rb
|
261
246
|
- lib/refinements/strings.rb
|
262
247
|
homepage: https://github.com/bkuhlmann/refinements
|
263
248
|
licenses:
|
@@ -274,15 +259,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
274
259
|
requirements:
|
275
260
|
- - "~>"
|
276
261
|
- !ruby/object:Gem::Version
|
277
|
-
version: '2.
|
262
|
+
version: '2.6'
|
278
263
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
279
264
|
requirements:
|
280
265
|
- - ">="
|
281
266
|
- !ruby/object:Gem::Version
|
282
267
|
version: '0'
|
283
268
|
requirements: []
|
284
|
-
|
285
|
-
rubygems_version: 2.7.6
|
269
|
+
rubygems_version: 3.0.2
|
286
270
|
signing_key:
|
287
271
|
specification_version: 4
|
288
272
|
summary: Provides additional enhancements (refinements) to core Ruby objects.
|
metadata.gz.sig
CHANGED
Binary file
|