rudash 2.5.0 → 2.6.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/remove.rb +17 -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: 60a8c07b41dbc424ce6a7c68759c0320ba21f0e7ed6836be5148c74a9d0fafc8
|
4
|
+
data.tar.gz: 80f3cb474075ef7495806343ee97e20eaaa5bbf031d06f00bfc69e40d2bfc069
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a7a49beea7967a040a985393dc1064287b1eb814df582343c4f25abe55cc7a1e7857d3666137e131c1c92f660ab6f56bcc01b3d53a84fc04fa5152dc8c189f1
|
7
|
+
data.tar.gz: 6548affd038871d4ff3daea1a3c8df1b77c53aba02ac4c3773ab98d31b09374d11987cb0a572c8e553435a0e24f0be30b1a64bdd2172351bca98b48069bb3421
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'identity.rb'
|
2
|
+
require_relative 'filter.rb'
|
3
|
+
|
4
|
+
module Remove
|
5
|
+
extend Identity
|
6
|
+
extend Negate
|
7
|
+
extend Filter
|
8
|
+
|
9
|
+
def remove(array, *rest_args)
|
10
|
+
predicate = self.head(rest_args) || self.method(:identity)
|
11
|
+
return [] if !array.is_a?(Array)
|
12
|
+
removed_items = self.filter(array, predicate)
|
13
|
+
|
14
|
+
array.replace(array - removed_items)
|
15
|
+
removed_items
|
16
|
+
end
|
17
|
+
end
|
data/lib/rudash.rb
CHANGED
@@ -42,6 +42,7 @@ require_relative './rudash/set.rb'
|
|
42
42
|
require_relative './rudash/pick.rb'
|
43
43
|
require_relative './rudash/update.rb'
|
44
44
|
require_relative './rudash/slice.rb'
|
45
|
+
require_relative './rudash/remove.rb'
|
45
46
|
|
46
47
|
class R_
|
47
48
|
extend Map
|
@@ -88,4 +89,5 @@ class R_
|
|
88
89
|
extend Pick
|
89
90
|
extend Update
|
90
91
|
extend Slice
|
92
|
+
extend Remove
|
91
93
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Islam Attrash
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- lib/rudash/pick.rb
|
53
53
|
- lib/rudash/reduce.rb
|
54
54
|
- lib/rudash/reduce_right.rb
|
55
|
+
- lib/rudash/remove.rb
|
55
56
|
- lib/rudash/reverse.rb
|
56
57
|
- lib/rudash/set.rb
|
57
58
|
- lib/rudash/size.rb
|