rudash 2.5.0 → 2.6.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/remove.rb +17 -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: 6f2fed4f9abdb97b675a8b13c97b76584cb8959aa1c22602aff9835163dfbc9d
4
- data.tar.gz: d0df727b737b72c1830a03b8d5c47471131432d0fdad933e9ada34e1d9598b19
3
+ metadata.gz: 60a8c07b41dbc424ce6a7c68759c0320ba21f0e7ed6836be5148c74a9d0fafc8
4
+ data.tar.gz: 80f3cb474075ef7495806343ee97e20eaaa5bbf031d06f00bfc69e40d2bfc069
5
5
  SHA512:
6
- metadata.gz: 840f058a91c0df1290c7f3f1a33d2287ba71e9409e8dbc4ef4f23e86911b4074f965642bd6f03156bc5b843568e540fe2bbfd9d2572dd13e9604d873d3f81a01
7
- data.tar.gz: dfd2d01f642cd48fe7247fc2e24490674cd08c8724e6429ac4fc8cd9dcafda8a2fafa37bc0d73b462f5a68b75b87f2af1a385679bca16f2dd832062b602a7d93
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.5.0
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