refinements 0.1.0 → 1.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 +4 -4
- checksums.yaml.gz.sig +1 -2
- data.tar.gz.sig +0 -0
- data/README.md +93 -20
- data/lib/refinements.rb +0 -2
- data/lib/refinements/array_extensions.rb +3 -2
- data/lib/refinements/big_decimal_extensions.rb +1 -0
- data/lib/refinements/identity.rb +3 -2
- data/lib/refinements/tasks/rspec.rake +6 -0
- data/lib/refinements/tasks/rubocop.rake +6 -0
- metadata +54 -10
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 187d41db156d487f8f558ff6479bdaf1b5529175
|
4
|
+
data.tar.gz: 3944401486fe06119d64a1412bb64a23c12653fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dedc8913cb29503b6589cede6211caef97708a977793c612374abb00b8d72ed1100cce3f7bd7be441dcd5ebaa7d02ef954c29f1ac6810aa34902ab9b14e30df8
|
7
|
+
data.tar.gz: 69caac9d19cb287026da1fbb992dfa6ae8b9d58efe07baa01ec263fe7f5f3ad1ee534da2508bb8a8f15da65e4e7ec7baf9bc2153b87794c2b57f14a29d1b124d
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
W
|
2
|
-
��`��GqK<��
|
1
|
+
������ze���$(k�o�O6d�z�U�>���rƂ�q2��@�����?�W?����T/��HE�I"�N�HD�Q)�s�������;�9R�,�U�[Y�҇n1dWMd��A!b��j�f�8:X��w�V���$�l|�I42��!u���w���(L�W�*�\��d�Kυ�?��"Y0FK�8nf��t���Eum�Jl����\�ﳖw�r�dvX�~�>,[ږ�="�Nw��_���6��.eV0s�
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -1,20 +1,69 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
[
|
6
|
-
[
|
7
|
-
[
|
8
|
-
|
9
|
-
|
1
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
2
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
3
|
+
# Table of Contents
|
4
|
+
|
5
|
+
- [Refinements](#refinements)
|
6
|
+
- [Table of Contents](#table-of-contents)
|
7
|
+
- [Features](#features)
|
8
|
+
- [Requirements](#requirements)
|
9
|
+
- [Setup](#setup)
|
10
|
+
- [Usage](#usage)
|
11
|
+
- [Requires](#requires)
|
12
|
+
- [Using](#using)
|
13
|
+
- [Examples](#examples)
|
14
|
+
- [Array](#array)
|
15
|
+
- [Big Decimal](#big-decimal)
|
16
|
+
- [Tests](#tests)
|
17
|
+
- [Versioning](#versioning)
|
18
|
+
- [Code of Conduct](#code-of-conduct)
|
19
|
+
- [Contributions](#contributions)
|
20
|
+
- [License](#license)
|
21
|
+
- [History](#history)
|
22
|
+
- [Credits](#credits)
|
23
|
+
|
24
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
25
|
+
|
26
|
+
# Refinements
|
27
|
+
|
28
|
+
[](http://badge.fury.io/rb/refinements)
|
29
|
+
[](https://codeclimate.com/github/bkuhlmann/refinements)
|
30
|
+
[](https://codeclimate.com/github/bkuhlmann/refinements)
|
31
|
+
[](https://gemnasium.com/bkuhlmann/refinements)
|
32
|
+
[](http://travis-ci.org/bkuhlmann/refinements)
|
33
|
+
[](https://www.patreon.com/bkuhlmann)
|
34
|
+
|
35
|
+
Provides a collection of refinements for core Ruby objects.
|
36
|
+
|
37
|
+
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
38
|
+
|
39
|
+
# Table of Contents
|
40
|
+
|
41
|
+
- [Features](#features)
|
42
|
+
- [Requirements](#requirements)
|
43
|
+
- [Setup](#setup)
|
44
|
+
- [Usage](#usage)
|
45
|
+
- [Requires](#requires)
|
46
|
+
- [Using](#using)
|
47
|
+
- [Examples](#examples)
|
48
|
+
- [Array](#array)
|
49
|
+
- [Big Decimal](#big-decimal)
|
50
|
+
- [Tests](#tests)
|
51
|
+
- [Versioning](#versioning)
|
52
|
+
- [Code of Conduct](#code-of-conduct)
|
53
|
+
- [Contributions](#contributions)
|
54
|
+
- [License](#license)
|
55
|
+
- [History](#history)
|
56
|
+
- [Credits](#credits)
|
57
|
+
|
58
|
+
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
10
59
|
|
11
60
|
# Features
|
12
61
|
|
13
|
-
- Adds
|
14
|
-
- Array#compress - Removes nil and empty values without modifying original values.
|
15
|
-
- Array#compress
|
16
|
-
- Adds
|
17
|
-
- BigDecimal#inspect - Allows one to inspect a big decimal with numeric representation.
|
62
|
+
- Adds Array refinements:
|
63
|
+
- `Array#compress` - Removes nil and empty values without modifying original values.
|
64
|
+
- `Array#compress!` - Removes nil and empty values and modifies original values.
|
65
|
+
- Adds BigDecimal refinements:
|
66
|
+
- `BigDecimal#inspect` - Allows one to inspect a big decimal with numeric representation.
|
18
67
|
|
19
68
|
# Requirements
|
20
69
|
|
@@ -34,11 +83,37 @@ For an insecure install, type the following (not recommended):
|
|
34
83
|
|
35
84
|
gem install refinements
|
36
85
|
|
86
|
+
Add the following to your Gemfile file:
|
87
|
+
|
88
|
+
gem "refinements"
|
89
|
+
|
37
90
|
# Usage
|
38
91
|
|
39
|
-
##
|
92
|
+
## Requires
|
93
|
+
|
94
|
+
Due to this gem being a collection of Ruby refinements, none of the refinements are auto-loaded by default in order to
|
95
|
+
reduce code bloat for your app. Instead, require the specific requirement for the code that needs it. You'll want to
|
96
|
+
require one or all of the following:
|
97
|
+
|
98
|
+
require "refinements/array_extensions"
|
99
|
+
require "refinements/big_decimal_extensions"
|
40
100
|
|
41
|
-
|
101
|
+
## Using
|
102
|
+
|
103
|
+
In addition to requiring the appropriate refinement file for the code that needs it, you'll also need to use the
|
104
|
+
refinement by using the `using` keyword within your object. You'll want to use one or all of the following:
|
105
|
+
|
106
|
+
class Example
|
107
|
+
using Refinements::ArrayExtensions
|
108
|
+
using Refinements::BigDecimalExtensions
|
109
|
+
end
|
110
|
+
|
111
|
+
## Examples
|
112
|
+
|
113
|
+
With the appropriate refinements required and used within your objects, the following sections demonstrates how each
|
114
|
+
refinement enriches your objects with new capabilities.
|
115
|
+
|
116
|
+
### Array
|
42
117
|
|
43
118
|
example = ["An", nil, "", "Example"]
|
44
119
|
example.compress # => ["An", "Example"]
|
@@ -48,9 +123,7 @@ For an insecure install, type the following (not recommended):
|
|
48
123
|
example.compress! # => ["An", "Example"]
|
49
124
|
example # => ["An", "Example"]
|
50
125
|
|
51
|
-
|
52
|
-
|
53
|
-
using Refinements::BigDecimalExtensions
|
126
|
+
### Big Decimal
|
54
127
|
|
55
128
|
big = BigDecimal.new "5.0E-10"
|
56
129
|
big.inspect # => "#<BigDecimal:3fd3d458fe84 0.0000000005>"
|
@@ -59,7 +132,7 @@ For an insecure install, type the following (not recommended):
|
|
59
132
|
|
60
133
|
To test, run:
|
61
134
|
|
62
|
-
bundle exec
|
135
|
+
bundle exec rake
|
63
136
|
|
64
137
|
# Versioning
|
65
138
|
|
data/lib/refinements.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
module Refinements
|
2
|
+
# Refinements for Arrays.
|
2
3
|
module ArrayExtensions
|
3
4
|
refine Array do
|
4
5
|
def compress
|
5
|
-
|
6
|
+
compact.reject(&:empty?)
|
6
7
|
end
|
7
8
|
|
8
9
|
def compress!
|
9
|
-
|
10
|
+
replace(compress)
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
data/lib/refinements/identity.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
module Refinements
|
2
|
+
# Gem identity information.
|
2
3
|
module Identity
|
3
4
|
def self.name
|
4
5
|
"refinements"
|
@@ -9,11 +10,11 @@ module Refinements
|
|
9
10
|
end
|
10
11
|
|
11
12
|
def self.version
|
12
|
-
"
|
13
|
+
"1.0.0"
|
13
14
|
end
|
14
15
|
|
15
16
|
def self.label_version
|
16
|
-
|
17
|
+
"#{label} #{version}"
|
17
18
|
end
|
18
19
|
end
|
19
20
|
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: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
aSif+qBc6oHD7EQWPF5cZkzkIURuwNwPBngZGxIKaMAgRhjGFXzUMAaq++r59cS9
|
31
31
|
xTfQ4k6fglKEgpnLAXiKdo2c8Ym+X4rIKFfedQ==
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2015-
|
33
|
+
date: 2015-11-21 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rake
|
@@ -46,6 +46,20 @@ dependencies:
|
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: gemsmith
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
49
63
|
- !ruby/object:Gem::Dependency
|
50
64
|
name: pry
|
51
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,7 +89,7 @@ dependencies:
|
|
75
89
|
- !ruby/object:Gem::Version
|
76
90
|
version: '0'
|
77
91
|
- !ruby/object:Gem::Dependency
|
78
|
-
name: pry-
|
92
|
+
name: pry-remote
|
79
93
|
requirement: !ruby/object:Gem::Requirement
|
80
94
|
requirements:
|
81
95
|
- - ">="
|
@@ -89,7 +103,7 @@ dependencies:
|
|
89
103
|
- !ruby/object:Gem::Version
|
90
104
|
version: '0'
|
91
105
|
- !ruby/object:Gem::Dependency
|
92
|
-
name: pry-
|
106
|
+
name: pry-state
|
93
107
|
requirement: !ruby/object:Gem::Requirement
|
94
108
|
requirements:
|
95
109
|
- - ">="
|
@@ -116,6 +130,20 @@ dependencies:
|
|
116
130
|
- - ">="
|
117
131
|
- !ruby/object:Gem::Version
|
118
132
|
version: '0'
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: pry-stack_explorer
|
135
|
+
requirement: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
type: :development
|
141
|
+
prerelease: false
|
142
|
+
version_requirements: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
119
147
|
- !ruby/object:Gem::Dependency
|
120
148
|
name: rspec
|
121
149
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,6 +214,20 @@ dependencies:
|
|
186
214
|
- - ">="
|
187
215
|
- !ruby/object:Gem::Version
|
188
216
|
version: '0'
|
217
|
+
- !ruby/object:Gem::Dependency
|
218
|
+
name: rubocop
|
219
|
+
requirement: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - ">="
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '0'
|
224
|
+
type: :development
|
225
|
+
prerelease: false
|
226
|
+
version_requirements: !ruby/object:Gem::Requirement
|
227
|
+
requirements:
|
228
|
+
- - ">="
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: '0'
|
189
231
|
- !ruby/object:Gem::Dependency
|
190
232
|
name: codeclimate-test-reporter
|
191
233
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,7 +242,7 @@ dependencies:
|
|
200
242
|
- - ">="
|
201
243
|
- !ruby/object:Gem::Version
|
202
244
|
version: '0'
|
203
|
-
description: Provides a collection of refinements
|
245
|
+
description: Provides a collection of refinements for core Ruby objects.
|
204
246
|
email:
|
205
247
|
- brooke@alchemists.io
|
206
248
|
executables: []
|
@@ -215,7 +257,9 @@ files:
|
|
215
257
|
- lib/refinements/array_extensions.rb
|
216
258
|
- lib/refinements/big_decimal_extensions.rb
|
217
259
|
- lib/refinements/identity.rb
|
218
|
-
|
260
|
+
- lib/refinements/tasks/rspec.rake
|
261
|
+
- lib/refinements/tasks/rubocop.rake
|
262
|
+
homepage: https://github.com/bkuhlmann/refinements
|
219
263
|
licenses:
|
220
264
|
- MIT
|
221
265
|
metadata: {}
|
@@ -225,9 +269,9 @@ require_paths:
|
|
225
269
|
- lib
|
226
270
|
required_ruby_version: !ruby/object:Gem::Requirement
|
227
271
|
requirements:
|
228
|
-
- - "
|
272
|
+
- - ">="
|
229
273
|
- !ruby/object:Gem::Version
|
230
|
-
version:
|
274
|
+
version: '0'
|
231
275
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
276
|
requirements:
|
233
277
|
- - ">="
|
@@ -235,8 +279,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
279
|
version: '0'
|
236
280
|
requirements: []
|
237
281
|
rubyforge_project:
|
238
|
-
rubygems_version: 2.
|
282
|
+
rubygems_version: 2.5.0
|
239
283
|
signing_key:
|
240
284
|
specification_version: 4
|
241
|
-
summary: Provides a collection of refinements
|
285
|
+
summary: Provides a collection of refinements for core Ruby objects.
|
242
286
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|