lite-ruby 1.0.19 → 1.0.20

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: b62cca1155994d26807711ee316fea8f1b34f3669decacd5345c77662ea1cbc8
4
- data.tar.gz: 57d062e524a7a4b208a05748b06e86d5b9a5c9b68874ecb8135f86e3e8560aa4
3
+ metadata.gz: 909d00d72336279c8efe3468116cec5a51e943787fd0882175ae350a360c43f8
4
+ data.tar.gz: b7a9511ab769cd3d8d8fc12287d9be829ef3d1c44c516e456de587ec42c061e4
5
5
  SHA512:
6
- metadata.gz: e11837df013186190c43feae3712be25a4bc286ac975b50219771ed055b0848501c5753759f81cc2e2ae288966a6b594b983b7d5f25101add2eeab57e6a4cf7f
7
- data.tar.gz: e4ea9ea29831381e7e363fde4b4a98129e42a00284bcbbd4fc9ede53bb48b0c4118c99f337b00d69b6f9bde344ec48038d1896cc3f8ec09c53064cab29c5673b
6
+ metadata.gz: b3fd86475d15693d2ab400190375ba322e6f72eac7a08582a1bf52b4593a6ff5d70f96355e8526d372f7af609e9d38023a5576d48a120c4afc6f1a9556e43011
7
+ data.tar.gz: e8ee6392456cb8370cc237a05cabbb014f61e90fb4b0c4223ab32cdbd2baab643d3ce34515e4b42abb575e3dc0ca89ee8adbd77b4f4e4c81b9eb9e499a3b33b3
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.0.20] - 2019-09-29
10
+ ### Added
11
+ - Added Array => `rand_sample`
12
+
9
13
  ## [1.0.19] - 2019-09-03
10
14
  ### Added
11
15
  - Added Array => `assert_min_values!`
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-ruby (1.0.19)
4
+ lite-ruby (1.0.20)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -31,8 +31,8 @@ GEM
31
31
  concurrent-ruby (1.1.5)
32
32
  crass (1.0.4)
33
33
  diff-lcs (1.3)
34
- erubi (1.8.0)
35
- fasterer (0.6.0)
34
+ erubi (1.9.0)
35
+ fasterer (0.7.0)
36
36
  colorize (~> 0.7)
37
37
  ruby_parser (>= 3.13.0)
38
38
  generator_spec (0.9.4)
@@ -41,16 +41,16 @@ GEM
41
41
  i18n (1.6.0)
42
42
  concurrent-ruby (~> 1.0)
43
43
  jaro_winkler (1.5.3)
44
- loofah (2.2.3)
44
+ loofah (2.3.0)
45
45
  crass (~> 1.0.2)
46
46
  nokogiri (>= 1.5.9)
47
47
  method_source (0.9.2)
48
48
  mini_portile2 (2.4.0)
49
- minitest (5.11.3)
49
+ minitest (5.12.2)
50
50
  nokogiri (1.10.4)
51
51
  mini_portile2 (~> 2.4.0)
52
52
  parallel (1.17.0)
53
- parser (2.6.4.0)
53
+ parser (2.6.4.1)
54
54
  ast (~> 2.4.0)
55
55
  rack (2.0.7)
56
56
  rack-test (1.1.0)
@@ -67,7 +67,7 @@ GEM
67
67
  rake (>= 0.8.7)
68
68
  thor (>= 0.20.3, < 2.0)
69
69
  rainbow (3.0.0)
70
- rake (12.3.3)
70
+ rake (13.0.0)
71
71
  rspec (3.8.0)
72
72
  rspec-core (~> 3.8.0)
73
73
  rspec-expectations (~> 3.8.0)
@@ -90,18 +90,18 @@ GEM
90
90
  unicode-display_width (>= 1.4.0, < 1.7)
91
91
  rubocop-performance (1.4.1)
92
92
  rubocop (>= 0.71.0)
93
- rubocop-rspec (1.35.0)
94
- rubocop (>= 0.60.0)
93
+ rubocop-rspec (1.36.0)
94
+ rubocop (>= 0.68.1)
95
95
  ruby-progressbar (1.10.1)
96
- ruby_parser (3.13.1)
96
+ ruby_parser (3.14.0)
97
97
  sexp_processor (~> 4.9)
98
- sexp_processor (4.12.1)
98
+ sexp_processor (4.13.0)
99
99
  thor (0.20.3)
100
100
  thread_safe (0.3.6)
101
101
  tzinfo (1.2.5)
102
102
  thread_safe (~> 0.1)
103
103
  unicode-display_width (1.6.0)
104
- zeitwerk (2.1.9)
104
+ zeitwerk (2.1.10)
105
105
 
106
106
  PLATFORMS
107
107
  ruby
@@ -240,6 +240,15 @@ Returns all of the positions of the matching value.
240
240
  [:a,:b,:a,:c].positions(:a) #=> [1, 3]
241
241
  ```
242
242
 
243
+ `rand_sample`
244
+ ------
245
+ Returns a sample of random n values by size or given.
246
+
247
+ ```ruby
248
+ [1, 2, 3].rand_sample #=> [3, 2]
249
+ [1, 2, 3].rand_sample(1) #=> [2]
250
+ ```
251
+
243
252
  `reject_values`
244
253
  ------
245
254
  Delete multiple values from a `dup` copy of the original array.
@@ -253,6 +253,11 @@ if Lite::Ruby.configuration.monkey_patches.include?('array')
253
253
  replace(promote(value))
254
254
  end
255
255
 
256
+ def rand_sample(max = nil)
257
+ amount = rand(1..(max || size))
258
+ sample(amount)
259
+ end
260
+
256
261
  def reject_values(*args)
257
262
  reject { |val| args.include?(val) }
258
263
  end
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Ruby
5
5
 
6
- VERSION ||= '1.0.19'
6
+ VERSION ||= '1.0.20'
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.19
4
+ version: 1.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-03 00:00:00.000000000 Z
11
+ date: 2019-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler