refinements 4.1.0 → 4.2.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 +4 -4
- data/README.md +39 -39
- data/lib/refinements/identity.rb +1 -1
- metadata +24 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9c6a5e6b76dfce751d153a664d67e8ec377cce2
|
4
|
+
data.tar.gz: 84dc90de33d9dcd70aac31a84015912ec50d44e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2c62e6f0340eba843cad140aebd1289e91364450a8f0a8ab9cb657b0415d08aeb66e2936c0263286184cb1432cdd2b7b6c0bbdf8378b28f12a9d83f721b4322
|
7
|
+
data.tar.gz: 930769c41347f5d19ba1ee4740b26166af7a0f7e95b6d2e567a14f316933942c70ba0b5c35ffd1a9eeb9b6071561576a0e472cf4c9a1b98ad28eaf01cd9dfd55
|
data/README.md
CHANGED
@@ -4,37 +4,37 @@
|
|
4
4
|
[](https://codeclimate.com/github/bkuhlmann/refinements)
|
5
5
|
[](https://codeclimate.com/github/bkuhlmann/refinements)
|
6
6
|
[](https://gemnasium.com/bkuhlmann/refinements)
|
7
|
-
[](https://circleci.com/gh/bkuhlmann/refinements)
|
8
8
|
[](https://www.patreon.com/bkuhlmann)
|
9
9
|
|
10
10
|
Provides a collection of refinements to core Ruby objects.
|
11
11
|
|
12
12
|
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
- [Features](#features)
|
17
|
-
- [Requirements](#requirements)
|
18
|
-
- [Setup](#setup)
|
19
|
-
- [Usage](#usage)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- [Tests](#tests)
|
28
|
-
- [Versioning](#versioning)
|
29
|
-
- [Code of Conduct](#code-of-conduct)
|
30
|
-
- [Contributions](#contributions)
|
31
|
-
- [License](#license)
|
32
|
-
- [History](#history)
|
33
|
-
- [Credits](#credits)
|
14
|
+
## Table of Contents
|
15
|
+
|
16
|
+
- [Features](#features)
|
17
|
+
- [Requirements](#requirements)
|
18
|
+
- [Setup](#setup)
|
19
|
+
- [Usage](#usage)
|
20
|
+
- [Requires](#requires)
|
21
|
+
- [Using](#using)
|
22
|
+
- [Examples](#examples)
|
23
|
+
- [String](#string)
|
24
|
+
- [Big Decimal](#big-decimal)
|
25
|
+
- [Array](#array)
|
26
|
+
- [Hash](#hash)
|
27
|
+
- [Tests](#tests)
|
28
|
+
- [Versioning](#versioning)
|
29
|
+
- [Code of Conduct](#code-of-conduct)
|
30
|
+
- [Contributions](#contributions)
|
31
|
+
- [License](#license)
|
32
|
+
- [History](#history)
|
33
|
+
- [Credits](#credits)
|
34
34
|
|
35
35
|
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
36
36
|
|
37
|
-
|
37
|
+
## Features
|
38
38
|
|
39
39
|
- Provides Array refinements:
|
40
40
|
- `Array#compress` - Removes `nil` and empty values without modifying itself.
|
@@ -65,12 +65,12 @@ Provides a collection of refinements to core Ruby objects.
|
|
65
65
|
- `#use` - Provides hash value computation, via a block, by using
|
66
66
|
only the keys as arguments to the block.
|
67
67
|
|
68
|
-
|
68
|
+
## Requirements
|
69
69
|
|
70
70
|
0. [Ruby 2.4.x](https://www.ruby-lang.org).
|
71
71
|
0. A solid understanding of [Ruby refinements and lexical scope](https://www.youtube.com/watch?v=qXC9Gk4dCEw).
|
72
72
|
|
73
|
-
|
73
|
+
## Setup
|
74
74
|
|
75
75
|
For a secure install, type the following from the command line (recommended):
|
76
76
|
|
@@ -89,9 +89,9 @@ Add the following to your Gemfile file:
|
|
89
89
|
|
90
90
|
gem "refinements"
|
91
91
|
|
92
|
-
|
92
|
+
## Usage
|
93
93
|
|
94
|
-
|
94
|
+
### Requires
|
95
95
|
|
96
96
|
If all refinements are not desired, add the following to your `Gemfile` instead:
|
97
97
|
|
@@ -104,7 +104,7 @@ If all refinements are not desired, add the following to your `Gemfile` instead:
|
|
104
104
|
require "refinements/hashes"
|
105
105
|
require "refinements/strings"
|
106
106
|
|
107
|
-
|
107
|
+
### Using
|
108
108
|
|
109
109
|
Much like including/extending a module, you'll need modify your object(s) to use the refinement(s):
|
110
110
|
|
@@ -115,11 +115,11 @@ Much like including/extending a module, you'll need modify your object(s) to use
|
|
115
115
|
using Refinements::Strings
|
116
116
|
end
|
117
117
|
|
118
|
-
|
118
|
+
### Examples
|
119
119
|
|
120
120
|
The following sections demonstrate how each refinement enriches your objects with new capabilities.
|
121
121
|
|
122
|
-
|
122
|
+
#### String
|
123
123
|
|
124
124
|
"example".first # => "e"
|
125
125
|
"example".first 4 # => "exam"
|
@@ -134,12 +134,12 @@ The following sections demonstrate how each refinement enriches your objects wit
|
|
134
134
|
"ThisIsAnExample".snakecase # => "this_is_an_example"
|
135
135
|
"ThisIsAnExample".titleize # => "This Is An Example"
|
136
136
|
|
137
|
-
|
137
|
+
#### Big Decimal
|
138
138
|
|
139
139
|
big = BigDecimal.new "5.0E-10"
|
140
140
|
big.inspect # => "#<BigDecimal:3fd3d458fe84 0.0000000005>"
|
141
141
|
|
142
|
-
|
142
|
+
#### Array
|
143
143
|
|
144
144
|
example = ["An", nil, "", "Example"]
|
145
145
|
example.compress # => ["An", "Example"]
|
@@ -149,7 +149,7 @@ The following sections demonstrate how each refinement enriches your objects wit
|
|
149
149
|
example.compress! # => ["An", "Example"]
|
150
150
|
example # => ["An", "Example"]
|
151
151
|
|
152
|
-
|
152
|
+
#### Hash
|
153
153
|
|
154
154
|
example = {a: 1, b: 2, c: 3}
|
155
155
|
example.except :a, :b # => {c: 3}
|
@@ -194,13 +194,13 @@ The following sections demonstrate how each refinement enriches your objects wit
|
|
194
194
|
example = {unit: "221B", street: "Baker Street", city: "London", country: "UK"}
|
195
195
|
example.use { |unit, street| "#{unit} #{street}" } # => "221B Baker Street"
|
196
196
|
|
197
|
-
|
197
|
+
## Tests
|
198
198
|
|
199
199
|
To test, run:
|
200
200
|
|
201
201
|
bundle exec rake
|
202
202
|
|
203
|
-
|
203
|
+
## Versioning
|
204
204
|
|
205
205
|
Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
|
206
206
|
|
@@ -208,26 +208,26 @@ Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
|
|
208
208
|
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
209
209
|
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
210
210
|
|
211
|
-
|
211
|
+
## Code of Conduct
|
212
212
|
|
213
213
|
Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
|
214
214
|
participating in this project you agree to abide by its terms.
|
215
215
|
|
216
|
-
|
216
|
+
## Contributions
|
217
217
|
|
218
218
|
Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
219
219
|
|
220
|
-
|
220
|
+
## License
|
221
221
|
|
222
222
|
Copyright (c) 2015 [Alchemists](https://www.alchemists.io).
|
223
223
|
Read [LICENSE](LICENSE.md) for details.
|
224
224
|
|
225
|
-
|
225
|
+
## History
|
226
226
|
|
227
227
|
Read [CHANGES](CHANGES.md) for details.
|
228
228
|
Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
|
229
229
|
|
230
|
-
|
230
|
+
## Credits
|
231
231
|
|
232
232
|
Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
|
233
233
|
[Alchemists](https://www.alchemists.io).
|
data/lib/refinements/identity.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinements
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '1.
|
131
|
+
version: '1.8'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '1.
|
138
|
+
version: '1.8'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,34 +164,48 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '4.7'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: git-cop
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '1.3'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '1.3'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: reek
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
185
|
- - "~>"
|
172
186
|
- !ruby/object:Gem::Version
|
173
|
-
version: '4.
|
187
|
+
version: '4.7'
|
174
188
|
type: :development
|
175
189
|
prerelease: false
|
176
190
|
version_requirements: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
192
|
- - "~>"
|
179
193
|
- !ruby/object:Gem::Version
|
180
|
-
version: '4.
|
194
|
+
version: '4.7'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: rubocop
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
184
198
|
requirements:
|
185
199
|
- - "~>"
|
186
200
|
- !ruby/object:Gem::Version
|
187
|
-
version: '0.
|
201
|
+
version: '0.49'
|
188
202
|
type: :development
|
189
203
|
prerelease: false
|
190
204
|
version_requirements: !ruby/object:Gem::Requirement
|
191
205
|
requirements:
|
192
206
|
- - "~>"
|
193
207
|
- !ruby/object:Gem::Version
|
194
|
-
version: '0.
|
208
|
+
version: '0.49'
|
195
209
|
- !ruby/object:Gem::Dependency
|
196
210
|
name: codeclimate-test-reporter
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|