lite-ruby 1.0.22 → 1.0.23

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: 5793ac2130287b2a84f505eed05fc25ef5f58780efd98d0290f50bebff290219
4
- data.tar.gz: '051910e39e8295339e26675013a22a5cc9837ac13dc7dea1f85bf3c236211f78'
3
+ metadata.gz: de09ab0594d972887d12050c1bf332ba900abedb449a55c915771c80ebcee2d5
4
+ data.tar.gz: 98336aec901f5855b1b92cd8ef9a8295301f3d33f292b26447dfa86225b978d5
5
5
  SHA512:
6
- metadata.gz: a8511007a6745b21aa3ff49af439e223ea8e4c830c90f804be768d6dc59119a22fb0a91acd7def07cfb6dd703608452ab4d7d369fccd161fd1c272786a343a0f
7
- data.tar.gz: aac608857cd852d41ee35d8d278bc55337818ef35a3f4212f9dc852aee4140d1bcdc5476207751fc0214216654cd7e497b2a58e15df28f8bfce248f64883eaf1
6
+ metadata.gz: cf2a737df82989a45263a43d10c18c95e52b32125b272d00bccc86920e79cb4d60100e3fd720b850979bed4e9200ea9a573b7a3dff3ebb2135c15b2434221ca4
7
+ data.tar.gz: 3cd06a4bdce35382951aa217378803842bfdfaeed51d4088c6ebba1fdcae5c075eebe9b36876f82fdd904a68c7356c984717b6cad42b488f639f65307184df45
data/.rubocop.yml CHANGED
@@ -14,6 +14,8 @@ Layout/EmptyLinesAroundModuleBody:
14
14
  EnforcedStyle: empty_lines_except_namespace
15
15
  Layout/LineLength:
16
16
  Max: 100
17
+ Layout/SpaceAroundMethodCallOperator:
18
+ Enabled: true
17
19
  Lint/RaiseException:
18
20
  Enabled: true
19
21
  Lint/StructNewOverride:
@@ -37,6 +39,8 @@ Style/Documentation:
37
39
  Enabled: false
38
40
  Style/ExpandPathArguments:
39
41
  Enabled: false
42
+ Style/ExponentialNotation:
43
+ Enabled: true
40
44
  Style/HashEachMethods:
41
45
  Enabled: true
42
46
  Style/HashTransformKeys:
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.0.23] - 2020-05-03
10
+ ### Added
11
+ - Added Array => `except`
12
+ - Added Array => `only`
13
+
9
14
  ## [1.0.22] - 2020-04-11
10
15
  ### Fixed
11
16
  - Fixed reverse_merge! on a frozen hash
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-ruby (1.0.22)
4
+ lite-ruby (1.0.23)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -50,7 +50,7 @@ GEM
50
50
  nokogiri (1.10.9)
51
51
  mini_portile2 (~> 2.4.0)
52
52
  parallel (1.19.1)
53
- parser (2.7.1.0)
53
+ parser (2.7.1.2)
54
54
  ast (~> 2.4.0)
55
55
  rack (2.2.2)
56
56
  rack-test (1.1.0)
@@ -73,16 +73,16 @@ GEM
73
73
  rspec-core (~> 3.9.0)
74
74
  rspec-expectations (~> 3.9.0)
75
75
  rspec-mocks (~> 3.9.0)
76
- rspec-core (3.9.1)
77
- rspec-support (~> 3.9.1)
76
+ rspec-core (3.9.2)
77
+ rspec-support (~> 3.9.3)
78
78
  rspec-expectations (3.9.1)
79
79
  diff-lcs (>= 1.2.0, < 2.0)
80
80
  rspec-support (~> 3.9.0)
81
81
  rspec-mocks (3.9.1)
82
82
  diff-lcs (>= 1.2.0, < 2.0)
83
83
  rspec-support (~> 3.9.0)
84
- rspec-support (3.9.2)
85
- rubocop (0.81.0)
84
+ rspec-support (3.9.3)
85
+ rubocop (0.82.0)
86
86
  jaro_winkler (~> 1.5.1)
87
87
  parallel (~> 1.10)
88
88
  parser (>= 2.7.0.1)
@@ -92,7 +92,7 @@ GEM
92
92
  unicode-display_width (>= 1.4.0, < 2.0)
93
93
  rubocop-performance (1.5.2)
94
94
  rubocop (>= 0.71.0)
95
- rubocop-rspec (1.38.1)
95
+ rubocop-rspec (1.39.0)
96
96
  rubocop (>= 0.68.1)
97
97
  ruby-progressbar (1.10.1)
98
98
  ruby_parser (3.14.2)
data/docs/ARRAY.md CHANGED
@@ -135,6 +135,14 @@ Returns a list of duplicate elements.
135
135
  [1, 1, 2, 2, 2, 3].duplicates(3) #=> [2]
136
136
  ```
137
137
 
138
+ `except(!)`
139
+ ------
140
+ Removes given values from the array.
141
+
142
+ ```ruby
143
+ [1, 2, 3, 4].except(1, 3) #=> [2, 4]
144
+ ```
145
+
138
146
  `from`
139
147
  ------
140
148
  Returns the tail of the array from a given position.
@@ -207,6 +215,14 @@ Converts blank values into `nil`.
207
215
  ['', 3, 4].nillify! #=> [nil, 3, 4]
208
216
  ```
209
217
 
218
+ `only(!)`
219
+ ------
220
+ Selects given values from the array.
221
+
222
+ ```ruby
223
+ [1, 2, 3, 4].only(1, 3) #=> [1, 3]
224
+ ```
225
+
210
226
  `probability`
211
227
  ------
212
228
  Generates a hash mapping each unique element in the array to the relative frequency, i.e. the probability, of it appearance.
@@ -137,6 +137,14 @@ if Lite::Ruby.configuration.monkey_patches.include?('array')
137
137
  hash.delete_if { |_, val| val < minimum }.keys
138
138
  end
139
139
 
140
+ def except(*values)
141
+ reject { |val| values.include?(val) }
142
+ end
143
+
144
+ def except!(*values)
145
+ replace(except(*values))
146
+ end
147
+
140
148
  def from(position)
141
149
  self[position, size] || []
142
150
  end
@@ -221,6 +229,14 @@ if Lite::Ruby.configuration.monkey_patches.include?('array')
221
229
  replace(nillify)
222
230
  end
223
231
 
232
+ def only(*values)
233
+ select { |val| values.include?(val) }
234
+ end
235
+
236
+ def only!(*values)
237
+ replace(only(*values))
238
+ end
239
+
224
240
  def position(value)
225
241
  idx = index(value)
226
242
  return idx if idx.nil?
@@ -278,7 +294,7 @@ if Lite::Ruby.configuration.monkey_patches.include?('array')
278
294
  array = [[]]
279
295
 
280
296
  if block_given?
281
- each { |val| yield(val) ? (array << []) : (array .last << val) }
297
+ each { |val| yield(val) ? (array << []) : (array.last << val) }
282
298
  else
283
299
  dup_arr = dup
284
300
 
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Ruby
5
5
 
6
- VERSION ||= '1.0.22'
6
+ VERSION ||= '1.0.23'
7
7
 
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lite-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.22
4
+ version: 1.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-11 00:00:00.000000000 Z
11
+ date: 2020-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler