corefines 1.8.0 → 1.11.1
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 +5 -5
- data/CHANGELOG.adoc +23 -1
- data/LICENSE +1 -1
- data/README.adoc +8 -9
- data/lib/corefines/enumerable.rb +39 -0
- data/lib/corefines/hash.rb +86 -8
- data/lib/corefines/string.rb +7 -7
- data/lib/corefines/version.rb +1 -1
- data/spec/enumerable/map_by_spec.rb +28 -0
- data/spec/hash/flat_map_spec.rb +61 -0
- data/spec/hash/recurse_spec.rb +36 -0
- data/spec/spec_helper.rb +10 -3
- data/spec/string/color_spec.rb +1 -1
- metadata +12 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e1786b22dad695d512f646e225334eeae9ecb2621a067461dc5c01151137ead0
|
4
|
+
data.tar.gz: 128135d2233f9b74976347ee1bbb4cae8b91327227aa4ed0e13432011f51d689
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5159cba9976f0b56054472b43a3f0c28ce100eda5e6efe79896b97fdba42f078edc91327066b7dd99c3e9698b87c7ae643ad6989057ccf9d1b728f315bfd990d
|
7
|
+
data.tar.gz: a0158e47cc535f3e604a992ffac923812b1df13af300a2b91c56e77ab9a1983a374a5f630dfb11f005bbfd29926ca0504a17c976504b7feb0abf206a5b6f7b47
|
data/CHANGELOG.adoc
CHANGED
@@ -3,9 +3,31 @@
|
|
3
3
|
:doc-base-url: http://www.rubydoc.info/github/jirutka/corefines/Corefines
|
4
4
|
:issue-uri: {repo-uri}/issues
|
5
5
|
|
6
|
+
|
7
|
+
== 1.11.1 (2021-07-21)
|
8
|
+
|
9
|
+
* Fix String#rekey with symbol proc (e.g. `&:to_s`) failing on Ruby 3.0.
|
10
|
+
|
11
|
+
|
12
|
+
== 1.11.0 (2017-09-15)
|
13
|
+
|
14
|
+
* Add new refinement {doc-base-url}/Hash/Recurse[Hash#recurse].
|
15
|
+
* Add new refinement {doc-base-url}/Hash/FlatMap[Hash#flat_map].
|
16
|
+
|
17
|
+
|
18
|
+
== 1.10.0 (2017-07-26)
|
19
|
+
|
20
|
+
* Replace deprecated `Fixnum` with `Integer`.
|
21
|
+
|
22
|
+
|
23
|
+
== 1.9.0 (2016-02-03)
|
24
|
+
|
25
|
+
* Add new refinement {doc-base-url}/Enumerable/MapBy[Enumerable#map_by].
|
26
|
+
|
27
|
+
|
6
28
|
== 1.8.0 (2015-07-06)
|
7
29
|
|
8
|
-
* Add new refinement {doc-base-url}/Class/
|
30
|
+
* Add new refinement {doc-base-url}/Class/Descendants[Class#descendants].
|
9
31
|
|
10
32
|
|
11
33
|
== 1.7.0 (2015-07-05)
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright 2015 Jakub Jirutka <jakub@jirutka.cz>.
|
3
|
+
Copyright 2015-2017 Jakub Jirutka <jakub@jirutka.cz>.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.adoc
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
= Corefines
|
2
2
|
Jakub Jirutka <https://github.com/jirutka[@jirutka]>
|
3
|
-
:page-layout: base
|
4
|
-
:idprefix:
|
5
|
-
ifdef::env-github[:idprefix: user-content-]
|
6
|
-
:idseparator: -
|
7
3
|
:source-language: ruby
|
8
|
-
:language: {source-language}
|
9
4
|
// custom
|
10
5
|
:gem-name: corefines
|
6
|
+
:gem-version: 1.11.1
|
11
7
|
:gh-name: jirutka/{gem-name}
|
12
8
|
:gh-branch: master
|
13
9
|
:badge-style: flat
|
@@ -40,13 +36,13 @@ TODO
|
|
40
36
|
|
41
37
|
Add this line to your application’s Gemfile:
|
42
38
|
|
43
|
-
[source]
|
44
|
-
gem '
|
39
|
+
[source, subs="+attributes"]
|
40
|
+
gem '{gem-name}', '~> {gem-version}'
|
45
41
|
|
46
42
|
or to your gemspec:
|
47
43
|
|
48
|
-
[source]
|
49
|
-
s.add_runtime_dependency '
|
44
|
+
[source, subs="+attributes"]
|
45
|
+
s.add_runtime_dependency '{gem-name}', '~> {gem-version}'
|
50
46
|
|
51
47
|
and then execute:
|
52
48
|
|
@@ -138,6 +134,7 @@ Not ideal indeed, but probably the best of what we can achieve.
|
|
138
134
|
* {doc-base-url}/Enumerable[Enumerable]
|
139
135
|
** {doc-base-url}/Enumerable/IndexBy[#index_by]
|
140
136
|
** {doc-base-url}/Enumerable/Many[#many?]
|
137
|
+
** {doc-base-url}/Enumerable/MapBy[#map_by]
|
141
138
|
** {doc-base-url}/Enumerable/MapSend[#map_send]
|
142
139
|
** {doc-base-url}/Enumerable/MapTo[#map_to]
|
143
140
|
* {doc-base-url}/Hash[Hash]
|
@@ -146,8 +143,10 @@ Not ideal indeed, but probably the best of what we can achieve.
|
|
146
143
|
** {doc-base-url}/Hash/Compact[#compact!]
|
147
144
|
** {doc-base-url}/Hash/Except[#except]
|
148
145
|
** {doc-base-url}/Hash/Except[#except!]
|
146
|
+
** {doc-base-url}/Hash/FlatMap[#flat_map]
|
149
147
|
** {doc-base-url}/Hash/Only[#only]
|
150
148
|
** {doc-base-url}/Hash/Only[#only!]
|
149
|
+
** {doc-base-url}/Hash/Recurse[#recurse]
|
151
150
|
** {doc-base-url}/Hash/Rekey[#rekey]
|
152
151
|
** {doc-base-url}/Hash/Rekey[#rekey!]
|
153
152
|
** {doc-base-url}/Hash/SymbolizeKeys[#symbolize_keys]
|
data/lib/corefines/enumerable.rb
CHANGED
@@ -77,6 +77,45 @@ module Corefines
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
##
|
81
|
+
# @!method map_by(&block)
|
82
|
+
# Converts enumerable into a Hash, iterating over each element where the
|
83
|
+
# provided block must return an array of two elements: a key and a value
|
84
|
+
# to be added into an array that corresponds to that key.
|
85
|
+
#
|
86
|
+
# It's similar to {::Enumerable#group_by}, but allows to map the value
|
87
|
+
# being added into a group.
|
88
|
+
#
|
89
|
+
# @example
|
90
|
+
# a = [1, 2, 3, 4, 5]
|
91
|
+
# a.map_by { |e| [e % 2, e + 1] }
|
92
|
+
# #=> { 0 => [3, 5], 1 => [2, 4, 6] }
|
93
|
+
#
|
94
|
+
# @example
|
95
|
+
# h = { "Lucy" => 86, "Ruby" => 98, "Drew" => 94, "Lisa" => 54 }
|
96
|
+
# h.map_by { |k, v| [score(v), k] }
|
97
|
+
# #=> { "A" => ["Ruby", "Drew"], "B" => ["Lucy"], "F" => ["Lisa"] }
|
98
|
+
#
|
99
|
+
# @yield [obj] gives each element to the block.
|
100
|
+
# @yieldreturn [Array] an array with the key and the value.
|
101
|
+
# @return [Hash]
|
102
|
+
#
|
103
|
+
module MapBy
|
104
|
+
Support.classes_including_module(::Enumerable) do |klass|
|
105
|
+
|
106
|
+
refine klass do
|
107
|
+
def map_by
|
108
|
+
res = {}
|
109
|
+
each do |e|
|
110
|
+
k, v = yield(*e)
|
111
|
+
(res[k] ||= []) << v
|
112
|
+
end
|
113
|
+
res
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
80
119
|
##
|
81
120
|
# @!method map_send(method_name, *args, &block)
|
82
121
|
# Sends a message to each element and collects the result.
|
data/lib/corefines/hash.rb
CHANGED
@@ -69,6 +69,43 @@ module Corefines
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
+
##
|
73
|
+
# @!method flat_map(&block)
|
74
|
+
# Returns a new hash with the merged results of running the _block_ once
|
75
|
+
# for every entry in +self+.
|
76
|
+
#
|
77
|
+
# @example
|
78
|
+
# hash = { a: 1, b: 2, c: 3 }
|
79
|
+
# hash.flat_map { |k, v| {k => v * 2, k.upcase => v} if v % 2 == 1 }
|
80
|
+
# # => { a: 2, A: 1, c: 6, C: 3 }
|
81
|
+
# hash.flat_map { |k, v| [[k, v * 2], [k.upcase => v]] if v % 2 == 1 }
|
82
|
+
# # => { a: 2, A: 1, c: 6, C: 3 }
|
83
|
+
#
|
84
|
+
# @yield [key, value] gives every key-value pair to the block.
|
85
|
+
# @yieldreturn [#to_h, Array, nil] an object that will be interpreted as
|
86
|
+
# a Hash and merged into the result, or nil to omit this key-value.
|
87
|
+
# @return [Hash] a new hash.
|
88
|
+
module FlatMap
|
89
|
+
refine ::Hash do
|
90
|
+
def flat_map
|
91
|
+
each_with_object({}) do |(key, value), hash|
|
92
|
+
yielded = yield(key, value)
|
93
|
+
|
94
|
+
if yielded.is_a? ::Hash
|
95
|
+
hash.merge!(yielded)
|
96
|
+
elsif yielded.is_a? ::Array
|
97
|
+
# Array#to_h exists since Ruby 2.1.
|
98
|
+
yielded.each do |pair|
|
99
|
+
hash.store(*pair)
|
100
|
+
end
|
101
|
+
elsif yielded
|
102
|
+
hash.merge!(yielded.to_h)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
72
109
|
##
|
73
110
|
# @!method only(*keys)
|
74
111
|
# @example
|
@@ -132,6 +169,39 @@ module Corefines
|
|
132
169
|
end
|
133
170
|
end
|
134
171
|
|
172
|
+
##
|
173
|
+
# @!method recurse(&block)
|
174
|
+
# Transforms this hash and each of its sub-hashes recursively using the
|
175
|
+
# given _block_.
|
176
|
+
#
|
177
|
+
# It does not mutate the hash if the given _block_ is pure (i.e. does not
|
178
|
+
# modify given hashes, but returns new ones).
|
179
|
+
#
|
180
|
+
# @example
|
181
|
+
# hash = {"a" => 1, "b" => {"c" => {"e" => 5}, "d" => 4}}
|
182
|
+
#
|
183
|
+
# hash.recurse { |h| h.symbolize_keys } # => {a: 1, b: {c: {e: 5}, d: 4}}
|
184
|
+
# hash # => {"a" => 1, "b" => {"c" => {"e" => 5}, "d" => 4}}
|
185
|
+
#
|
186
|
+
# hash.recurse { |h| h.symbolize_keys! } # => {a: 1, b: {c: {e: 5}, d: 4}}
|
187
|
+
# hash # => {a: 1, b: {c: {e: 5}, d: 4}}
|
188
|
+
#
|
189
|
+
# @yield [Hash] gives this hash and every sub-hash (recursively).
|
190
|
+
# The return value replaces the old value.
|
191
|
+
# @return [Hash] a result of applying _block_ to this hash and each of
|
192
|
+
# its sub-hashes (recursively).
|
193
|
+
#
|
194
|
+
module Recurse
|
195
|
+
refine ::Hash do
|
196
|
+
def recurse(&block)
|
197
|
+
h = yield(self)
|
198
|
+
h.each do |key, value|
|
199
|
+
h[key] = value.recurse(&block) if value.is_a? ::Hash
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
135
205
|
##
|
136
206
|
# @!method rekey(key_map = nil, &block)
|
137
207
|
# Returns a new hash with keys transformed according to the given
|
@@ -177,20 +247,28 @@ module Corefines
|
|
177
247
|
refine ::Hash do
|
178
248
|
def rekey(key_map = nil, &block)
|
179
249
|
fail ArgumentError, "provide key_map, or block, not both" if key_map && block
|
180
|
-
block = ->(k, _) { k.to_sym rescue k } if !key_map && !block
|
181
250
|
|
182
251
|
# Note: self.dup is used to preserve the default_proc.
|
183
|
-
if
|
184
|
-
|
185
|
-
|
252
|
+
if key_map
|
253
|
+
key_map.each_with_object(dup) do |(from, to), hash|
|
254
|
+
hash[to] = hash.delete(from) if hash.key? from
|
255
|
+
end
|
256
|
+
else
|
257
|
+
transform_key = if !block
|
258
|
+
->(k, _) { k.to_sym rescue k }
|
259
|
+
elsif block.arity.abs == 1 || block.lambda? && block.arity != 2
|
260
|
+
# This is needed for "symbol procs" (e.g. &:to_s). It behaves
|
261
|
+
# differently since Ruby 3.0!
|
262
|
+
# Ruby <3.0: block.arity => -1, block.lambda? => false
|
263
|
+
# Ruby 3.0: block.arity => -2, block.lambda? => true
|
264
|
+
->(k, _) { block[k] }
|
265
|
+
else
|
266
|
+
block
|
267
|
+
end
|
186
268
|
|
187
269
|
each_with_object(dup.clear) do |(key, value), hash|
|
188
270
|
hash[ transform_key[key, value] ] = value
|
189
271
|
end
|
190
|
-
else
|
191
|
-
key_map.each_with_object(dup) do |(from, to), hash|
|
192
|
-
hash[to] = hash.delete(from) if hash.key? from
|
193
|
-
end
|
194
272
|
end
|
195
273
|
end
|
196
274
|
|
data/lib/corefines/string.rb
CHANGED
@@ -75,15 +75,15 @@ module Corefines
|
|
75
75
|
# "Sugar is sweet".color(text: 7) # => "\e[0;37;49mSugar is sweet\e[0m"
|
76
76
|
#
|
77
77
|
# @overload color(text_color)
|
78
|
-
# @param text_color [#to_sym,
|
78
|
+
# @param text_color [#to_sym, Integer] text (foreground) color (see
|
79
79
|
# {COLOR_CODES}).
|
80
80
|
#
|
81
81
|
# @overload color(opts)
|
82
|
-
# @option opts [#to_sym,
|
82
|
+
# @option opts [#to_sym, Integer] :mode text attributes (see
|
83
83
|
# {MODE_CODES}).
|
84
|
-
# @option opts [#to_sym,
|
84
|
+
# @option opts [#to_sym, Integer] :text,:fg text (foreground) color (see
|
85
85
|
# {COLOR_CODES}).
|
86
|
-
# @option opts [#to_sym,
|
86
|
+
# @option opts [#to_sym, Integer] :background,:bg background color (see
|
87
87
|
# {COLOR_CODES}).
|
88
88
|
#
|
89
89
|
# @return [String] a copy of this string colored for command line output
|
@@ -133,12 +133,12 @@ module Corefines
|
|
133
133
|
private
|
134
134
|
|
135
135
|
def self.color_code(color, offset)
|
136
|
-
return color + offset if color.is_a? ::
|
136
|
+
return color + offset if color.is_a? ::Integer
|
137
137
|
COLOR_CODES[color.to_sym] + offset if color && COLOR_CODES[color.to_sym]
|
138
138
|
end
|
139
139
|
|
140
140
|
def self.mode_code(mode)
|
141
|
-
return mode if mode.is_a? ::
|
141
|
+
return mode if mode.is_a? ::Integer
|
142
142
|
MODE_CODES[mode.to_sym] if mode
|
143
143
|
end
|
144
144
|
end
|
@@ -248,7 +248,7 @@ module Corefines
|
|
248
248
|
# "foo\n\nbar".indent(2) # => " foo\n\n bar"
|
249
249
|
# "foo\n\nbar".indent(2, nil, true) # => " foo\n \n bar"
|
250
250
|
#
|
251
|
-
# @param amount [
|
251
|
+
# @param amount [Integer] the indent size.
|
252
252
|
# @param indent_str [String, nil] the indent character to use.
|
253
253
|
# The default is +nil+, which tells the method to make a guess by
|
254
254
|
# peeking at the first indented line, and fallback to a space if
|
data/lib/corefines/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
describe Enumerable do
|
2
|
+
using Corefines::Enumerable::map_by
|
3
|
+
|
4
|
+
describe '#map_by' do
|
5
|
+
|
6
|
+
context Array do
|
7
|
+
let(:input) { [1, 2, 3, 4, 5] }
|
8
|
+
let(:expected) { { 0 => [3, 5], 1 => [2, 4, 6] } }
|
9
|
+
|
10
|
+
it "returns hash with the elements grouped and mapped by result of the block" do
|
11
|
+
expect(input.map_by { |e| [e % 2, e + 1] }).to eq expected
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context Hash do
|
16
|
+
let(:input) { { "Lucy" => 86, "Ruby" => 98, "Drew" => 94, "Lisa" => 54 } }
|
17
|
+
let(:expected) { { "A" => ["Ruby", "Drew"], "B" => ["Lucy"], "F" => ["Lisa"] } }
|
18
|
+
|
19
|
+
it "returns hash with the elements grouped and mapped by result of the block" do
|
20
|
+
expect(input.map_by { |k, v| [score(v), k] }).to eq expected
|
21
|
+
end
|
22
|
+
|
23
|
+
def score(n)
|
24
|
+
n < 70 ? 'F' : n < 80 ? 'C' : n < 90 ? 'B' : 'A'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
describe Hash do
|
4
|
+
describe '#flat_map' do
|
5
|
+
using Corefines::Hash::flat_map
|
6
|
+
|
7
|
+
let(:hash) { {a: 1, b: 2, c: 3} }
|
8
|
+
let!(:original) { hash.dup }
|
9
|
+
|
10
|
+
context "with block" do
|
11
|
+
it "returns a new hash, does not mutate self" do
|
12
|
+
expect( hash.flat_map { |k, v| {k => v * 2} } ).to be_a Hash
|
13
|
+
expect( hash ).to eq original
|
14
|
+
end
|
15
|
+
|
16
|
+
context "that yields Hash" do
|
17
|
+
it "returns merged results of running block for each entry" do
|
18
|
+
expect( hash.flat_map { |k, v| {k => v * 2, k.upcase => v * 3} } )
|
19
|
+
.to eq({a: 2, A: 3, b: 4, B: 6, c: 6, C: 9})
|
20
|
+
end
|
21
|
+
|
22
|
+
it "does not flatten yielded hashes" do
|
23
|
+
expect( hash.flat_map { |k, v| {k => {k.upcase => v}} } )
|
24
|
+
.to eq({a: {A: 1}, b: {B: 2}, c: {C: 3}})
|
25
|
+
end
|
26
|
+
|
27
|
+
it "omits entries for which the block yielded nil" do
|
28
|
+
expect( hash.flat_map { |k, v| {k.upcase => v * 2} if k != :b } )
|
29
|
+
.to eq({A: 2, C: 6})
|
30
|
+
end
|
31
|
+
|
32
|
+
it "handles duplicated keys by method the last wins" do
|
33
|
+
expect( hash.flat_map { |k, v| {k => v * 2, b: v * 6} } )
|
34
|
+
.to eq({a: 2, b: 18, c: 6})
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "that yields Array" do
|
39
|
+
it "interprets array of pairs as Hash" do
|
40
|
+
expect( hash.flat_map { |k, v| [[k, v * 2], [k.upcase, v * 3]] } )
|
41
|
+
.to eq({a: 2, A: 3, b: 4, B: 6, c: 6, C: 9})
|
42
|
+
end
|
43
|
+
|
44
|
+
it "raises ArgumentError if nested array has more than 2 elements" do
|
45
|
+
expect { hash.flat_map { |k, v| [[k, v, v]] } }.to raise_error(ArgumentError)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# There's no usable class in 1.9.3 implementing #to_h and I'd like to
|
50
|
+
# keep this simple...
|
51
|
+
if RUBY_VERSION.to_f >= 2
|
52
|
+
context "that yields object responding to #to_h" do
|
53
|
+
it "calls #to_h on yielded value" do
|
54
|
+
expect( hash.flat_map { |k, v| OpenStruct.new(k => v * 2) } )
|
55
|
+
.to eq({a: 2, b: 4, c: 6})
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
describe Hash do
|
2
|
+
describe '#recurse' do
|
3
|
+
using Corefines::Hash::recurse
|
4
|
+
|
5
|
+
subject(:hash) { {a: 1, b: {d: {f: 6}, e: 5}, c: 3} }
|
6
|
+
let(:expected) { {a: 1, b: {d: {f: 6, x: 42}, e: 5, x: 42}, c: 3, x: 42} }
|
7
|
+
let!(:original) { Marshal.load(Marshal.dump(hash)) } # deep clone
|
8
|
+
|
9
|
+
shared_examples :common do
|
10
|
+
it "returns a result of calling block on the hash and sub-hashes recursively" do
|
11
|
+
is_expected.to eq expected
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "with pure block" do
|
16
|
+
subject!(:result) { hash.recurse { |h| h.merge(x: 42) } }
|
17
|
+
|
18
|
+
include_examples :common
|
19
|
+
|
20
|
+
it "does not mutate the original hash" do
|
21
|
+
expect( hash ).to eq original
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with impure block" do
|
26
|
+
subject!(:result) { hash.recurse { |h| h.merge!(x: 42) } }
|
27
|
+
|
28
|
+
include_examples :common
|
29
|
+
|
30
|
+
it "modifies the hash in-place" do
|
31
|
+
expect( hash ).to eq expected
|
32
|
+
expect( hash ).to_not eq original
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'simplecov' unless RUBY_ENGINE == 'jruby'
|
2
|
-
require 'corefines'
|
3
|
-
|
4
1
|
RSpec.configure do |config|
|
5
2
|
|
6
3
|
# rspec-expectations config
|
@@ -28,3 +25,13 @@ RSpec.configure do |config|
|
|
28
25
|
|
29
26
|
config.color = true
|
30
27
|
end
|
28
|
+
|
29
|
+
unless RUBY_ENGINE == 'jruby'
|
30
|
+
require 'simplecov'
|
31
|
+
|
32
|
+
SimpleCov.start do
|
33
|
+
add_filter '/spec/'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
require 'corefines'
|
data/spec/string/color_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: corefines
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Jirutka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '1.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: '0
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '12.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '12.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0.
|
89
|
+
version: '0.9'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0.
|
96
|
+
version: '0.9'
|
97
97
|
description: |
|
98
98
|
Corefines is a collection of general purpose refinements for extending the core
|
99
99
|
capabilities of Ruby's built-in classes. It also provides a compatibility mode
|
@@ -127,12 +127,15 @@ files:
|
|
127
127
|
- spec/class/descendants_spec.rb
|
128
128
|
- spec/enumerable/index_by_spec.rb
|
129
129
|
- spec/enumerable/many_spec.rb
|
130
|
+
- spec/enumerable/map_by_spec.rb
|
130
131
|
- spec/enumerable/map_send_spec.rb
|
131
132
|
- spec/enumerable/map_to_spec.rb
|
132
133
|
- spec/hash/compact_spec.rb
|
133
134
|
- spec/hash/except_spec.rb
|
135
|
+
- spec/hash/flat_map_spec.rb
|
134
136
|
- spec/hash/only_spec.rb
|
135
137
|
- spec/hash/op_add_spec.rb
|
138
|
+
- spec/hash/recurse_spec.rb
|
136
139
|
- spec/hash/rekey_spec.rb
|
137
140
|
- spec/hash/symbolize_keys_spec.rb
|
138
141
|
- spec/module/alias_class_method_spec.rb
|
@@ -182,9 +185,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
185
|
version: '0'
|
183
186
|
requirements: []
|
184
187
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
188
|
+
rubygems_version: 2.7.3
|
186
189
|
signing_key:
|
187
190
|
specification_version: 4
|
188
191
|
summary: A collection of refinements for Ruby core classes.
|
189
192
|
test_files: []
|
190
|
-
has_rdoc: yard
|