rudash 2.12.1 → 2.13.0

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: c38108728a63feadae53822d148556bb36baf9b878b31e96e5d0f001f7f8b5d2
4
- data.tar.gz: 2aaa7cf2e3524c154c451843023f95f0c3662f6175baeb264f906881039b5d01
3
+ metadata.gz: b56da576534a47e10249114fcf614309b555b953cf4429356aa78f0f56e87c54
4
+ data.tar.gz: 3c1f5b409f01e1e882409c764c705846c15e31ab6a5837d2f491df551174c8ed
5
5
  SHA512:
6
- metadata.gz: ae6c39b3aa21a337f9ad64a6e1414656c054c12f09ec26934c3470fb4ee6753d357be859a28b740839c58b8718cd1f82048c9798a920cd5b80689d023218e2cc
7
- data.tar.gz: 322e18ecec3658ece61340ddd2433314df9205a31af5c7eae76964e01508e9790c41f0832982af2b2d50114f2848929ddf1a75b290daa232c10917fb30ae6e79
6
+ metadata.gz: d34d9153330154ee1cd08c0190acfbd6fe701e486539c20386d31b3c0697ea494b721fe35e61b6093a82af7efa8706434892953e74532e39c96722a49786f7a0
7
+ data.tar.gz: a16f4f2749ab707a75aa2c3dac1634e0dca67afa6d6f9b35722a8e0b604773a5c4b578f6287530aa589efaebee0ca341aa9e3e123de83789210122952bbb422c
@@ -0,0 +1,12 @@
1
+ module Rudash
2
+ module DropRight
3
+ def drop_right(array, *rest_args)
4
+ return [] if !self.is_array?(array)
5
+
6
+ n = self.head(rest_args) || 1
7
+ return array if n <= 0
8
+
9
+ self.take(array, self.size(array) - n)
10
+ end
11
+ end
12
+ end
data/lib/rudash.rb CHANGED
@@ -47,6 +47,7 @@ require_relative './rudash/reject.rb'
47
47
  require_relative './rudash/range.rb'
48
48
  require_relative './rudash/group_by.rb'
49
49
  require_relative './rudash/take.rb'
50
+ require_relative './rudash/drop_right.rb'
50
51
 
51
52
  # This is the exposed Gem class that contains all Rudash methods.
52
53
  # New methods can use already implemented methods in the library by refering to "self"
@@ -101,4 +102,5 @@ class R_
101
102
  extend Rudash::Range
102
103
  extend Rudash::GroupBy
103
104
  extend Rudash::Take
105
+ extend Rudash::DropRight
104
106
  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.12.1
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Islam Attrash
@@ -23,6 +23,7 @@ files:
23
23
  - lib/rudash/concat.rb
24
24
  - lib/rudash/curry.rb
25
25
  - lib/rudash/difference.rb
26
+ - lib/rudash/drop_right.rb
26
27
  - lib/rudash/each.rb
27
28
  - lib/rudash/each_right.rb
28
29
  - lib/rudash/eq.rb