rudash 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rudash/slice.rb +13 -0
- data/lib/rudash.rb +2 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f2fed4f9abdb97b675a8b13c97b76584cb8959aa1c22602aff9835163dfbc9d
|
4
|
+
data.tar.gz: d0df727b737b72c1830a03b8d5c47471131432d0fdad933e9ada34e1d9598b19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 840f058a91c0df1290c7f3f1a33d2287ba71e9409e8dbc4ef4f23e86911b4074f965642bd6f03156bc5b843568e540fe2bbfd9d2572dd13e9604d873d3f81a01
|
7
|
+
data.tar.gz: dfd2d01f642cd48fe7247fc2e24490674cd08c8724e6429ac4fc8cd9dcafda8a2fafa37bc0d73b462f5a68b75b87f2af1a385679bca16f2dd832062b602a7d93
|
data/lib/rudash/slice.rb
ADDED
@@ -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
|
+
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
|