refinements 7.7.0 → 7.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b7d7affd4176bb25ee87d3718b592a0bd2b07be2bad86d584f06f0d16dcd866
4
- data.tar.gz: 256ab9f274581c668a06949a41501c50885f9681dd6150c9b58046d59cf87de7
3
+ metadata.gz: dd72c4e1fda257b53dcd80a052db0ce99cd5b2987e531bea93f577e6b3b131f9
4
+ data.tar.gz: 67b83319903a39425640eb0534eab280e7cb138e588476c635c5192afb08758d
5
5
  SHA512:
6
- metadata.gz: 356b4ea5575bbec34d4b2c31495c59b49ce9efe00bedcce194d458c8bdbbcf47ca87e3be00b60f910af14e2768cf8b42de909fcdec652a895d8de706652e0777
7
- data.tar.gz: 0a7d8c6bd99585868ec7b2d119f7014e1c2ebf571324d23c8be209bd364417c4106f465a4f0dd6ab012fb6f82e1024ae803ef0d27949051e6c65b4aa2d6f63dd
6
+ metadata.gz: 8fab91775e301f8765dd3156ab91e6abdf9395bdf767fbf859f80a5d3ea2bbebabef8dbe9e5e5a65e33443082a13e127ce3d85c1384b3939d753347384dea99e
7
+ data.tar.gz: 74934f4fbb6336ad4c434961c865b826675a71b76f846faae7635e6e09d3aa99bd74a9c74d6f0289f2d63a0c3352c9e21aecb60e35c2485664879520b20a755d
@@ -1 +1,3 @@
1
- ���.��� Q~ҵᮺiÆV��<gS�:�8������f��@J�/�'�D�}*��O$���Br
1
+ !�������PWF�nk���~9�z��Z�3�o�GŚ��kw�+�~�� X�P���r4x�vq�p]���Ͱ�?��AMJM��Oc�y.π���i�Ql�P^��΅g�7��d � :�/oJ��ݱ�Fl_N_: kI':�M���KEW�P!
2
+ �k2����]
3
+ �RC���^��&��.����7W��T8-��:!�� /�?��5"Ix+��nOho�컎��r+���F���6m��%2P��f�
data.tar.gz.sig CHANGED
Binary file
@@ -18,6 +18,8 @@ toc::[]
18
18
  * *Arrays*:
19
19
  ** `#compress` - Removes `nil` and empty values without modifying itself.
20
20
  ** `#compress!` - Removes `nil` and empty values while modifying itself.
21
+ ** `#include` - Adds given array or elements without modifying itself.
22
+ ** `#exclude` - Removes given array or elements without modifying itself.
21
23
  ** `#ring` - Answers a circular array which can enumerate before, current, after elements.
22
24
  * *BigDecimals*:
23
25
  ** `#inspect` - Allows one to inspect a big decimal with numeric representation.
@@ -54,7 +56,7 @@ file for manipulation and immediate writing back to the same file.
54
56
  ** `#files` - Answers all or filtered files for current path.
55
57
  ** `#gsub` - Same behavior as `String#gsub` but answers a path with patterns replaced with desired
56
58
  substitutes.
57
- ** `#relative_parent_from` - Answers relative path from parent directory. This is a complement to
59
+ ** `#relative_parent` - Answers relative path from parent directory. This is a complement to
58
60
  `#relative_path_from`.
59
61
  ** `#make_ancestors` - Ensures all ancestor directories are created for a path.
60
62
  ** `#rewrite` - When given a block, it provides the contents of the recently read file for
@@ -173,6 +175,12 @@ example = ["An", nil, "", "Example"]
173
175
  example.compress! # => ["An", "Example"]
174
176
  example # => ["An", "Example"]
175
177
 
178
+ [1, 2, 3].include [4, 5] # => [1, 2, 3, 4, 5]
179
+ [1, 2, 3].include 4, 5 # => [1, 2, 3, 4, 5]
180
+
181
+ [1, 2, 3, 4, 5].exclude [4, 5] # => [1, 2, 3]
182
+ [1, 2, 3, 4, 5].include 4, 5 # => [1, 2, 3, 4, 5]
183
+
176
184
  example = [1, 2, 3]
177
185
  example.ring # => #<Enumerator: ...>
178
186
  example.ring { |(before, current, after)| puts "#{before} #{current} #{after}" }
@@ -11,6 +11,14 @@ module Refinements
11
11
  replace compress
12
12
  end
13
13
 
14
+ def include *elements
15
+ self + elements.flatten
16
+ end
17
+
18
+ def exclude *elements
19
+ self - elements.flatten
20
+ end
21
+
14
22
  def ring &block
15
23
  [last, *self, first].each_cons 3, &block
16
24
  end
@@ -5,7 +5,7 @@ module Refinements
5
5
  module Identity
6
6
  NAME = "refinements"
7
7
  LABEL = "Refinements"
8
- VERSION = "7.7.0"
8
+ VERSION = "7.8.0"
9
9
  VERSION_LABEL = "#{LABEL} #{VERSION}"
10
10
  end
11
11
  end
@@ -39,8 +39,14 @@ module Refinements
39
39
  self.class.new to_s.gsub(pattern, replacement)
40
40
  end
41
41
 
42
- def relative_parent_from root
43
- relative_path_from(root).parent
42
+ def relative_parent root_dir
43
+ relative_path_from(root_dir).parent
44
+ end
45
+
46
+ def relative_parent_from root_dir
47
+ warn "[DEPRECATION]: Pathname#relative_parent_from is deprecated, " \
48
+ "use Pathname#relative_parent instead."
49
+ relative_parent root_dir
44
50
  end
45
51
 
46
52
  def make_ancestors
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: 7.7.0
4
+ version: 7.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,7 +28,7 @@ cert_chain:
28
28
  2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
29
  QWc=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-08-05 00:00:00.000000000 Z
31
+ date: 2020-08-29 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler-audit
@@ -162,14 +162,14 @@ dependencies:
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: '0.83'
165
+ version: '0.89'
166
166
  type: :development
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: '0.83'
172
+ version: '0.89'
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: rubocop-performance
175
175
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file