rudash 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rudash/slice.rb +13 -0
  3. data/lib/rudash.rb +2 -0
  4. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c42a0d5f572e904adb836f7e67bf6c91b1a54c675a07382cad99063b25d0983
4
- data.tar.gz: 2132cab1f1aa7cbbf16b93bc22b3285a4d4cd10afaa2b09444e8a69b5025e3d1
3
+ metadata.gz: 6f2fed4f9abdb97b675a8b13c97b76584cb8959aa1c22602aff9835163dfbc9d
4
+ data.tar.gz: d0df727b737b72c1830a03b8d5c47471131432d0fdad933e9ada34e1d9598b19
5
5
  SHA512:
6
- metadata.gz: b764411b08782911a3efd6c6db5473cd76ed4f9a2a535cd6e159981915049014257441b6290525a7d4a46273b5571ff3afb051b474af837c584af1a862794adc
7
- data.tar.gz: 3a80b8b21589f6a09b9d40c0d6302be461734d84ea17b64a5fff85269554a4ca1829ec558d05f607ea0edf9e4f6188939be8be2619fe961b3430c11cab7e0a3b
6
+ metadata.gz: 840f058a91c0df1290c7f3f1a33d2287ba71e9409e8dbc4ef4f23e86911b4074f965642bd6f03156bc5b843568e540fe2bbfd9d2572dd13e9604d873d3f81a01
7
+ data.tar.gz: dfd2d01f642cd48fe7247fc2e24490674cd08c8724e6429ac4fc8cd9dcafda8a2fafa37bc0d73b462f5a68b75b87f2af1a385679bca16f2dd832062b602a7d93
@@ -0,0 +1,13 @@
1
+ module Slice
2
+ def slice(array, *rest_args)
3
+ return self.slice(array.split(''), *rest_args) if array.is_a?(String)
4
+ return [] if !array.is_a?(Array)
5
+
6
+ start_point = rest_args[0] || 0
7
+ end_point = rest_args[1] || array.size
8
+
9
+ return [] if !end_point.is_a?(Numeric)
10
+
11
+ array.slice(start_point, end_point - start_point) || []
12
+ end
13
+ end
data/lib/rudash.rb CHANGED
@@ -41,6 +41,7 @@ require_relative './rudash/initial.rb'
41
41
  require_relative './rudash/set.rb'
42
42
  require_relative './rudash/pick.rb'
43
43
  require_relative './rudash/update.rb'
44
+ require_relative './rudash/slice.rb'
44
45
 
45
46
  class R_
46
47
  extend Map
@@ -86,4 +87,5 @@ class R_
86
87
  extend Set
87
88
  extend Pick
88
89
  extend Update
90
+ extend Slice
89
91
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rudash
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Islam Attrash
@@ -55,6 +55,7 @@ files:
55
55
  - lib/rudash/reverse.rb
56
56
  - lib/rudash/set.rb
57
57
  - lib/rudash/size.rb
58
+ - lib/rudash/slice.rb
58
59
  - lib/rudash/some.rb
59
60
  - lib/rudash/tail.rb
60
61
  - lib/rudash/uniq.rb