rudash 3.0.7 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9dc2c29db4b71e43141cac51c0323b524bd47b6a85a692654e58334bcef5da16
4
- data.tar.gz: 94f2615e152498e46b91abe25619b41b6aa4922a69ad1393fa641aa83fb388ed
3
+ metadata.gz: 3ed37d5d3069ea882af8b587385f2f53bdb22b64f35169dfc9d5ade60d6fbf61
4
+ data.tar.gz: 1a72e4d939b5de24f294a168619081b53c19fcecb25d48d3c75203d820045f05
5
5
  SHA512:
6
- metadata.gz: 16911c7d2cee5a440e226759c3667e4385115d6ff177f9e8a39585510568193ba6f4f4b1634c372e44dfc39d5925d8919af1d3c413c7f9656b9b551a674b566f
7
- data.tar.gz: 3ac60f1e2e8c21900fb786b37440fdc5f3bbc2fc66109b930a763ba9b022b1f4bcedc7186a2fb9a8d9225a19e02e947fe132735262df59cb7f157c03df63794b
6
+ metadata.gz: 4ffb14c2df59e03ac9b03d187fa88684e51ad04f5c4eb68cd81d63b733fa4f04ca6c9e7cd9060f57c004f439b7ca1b6c971c154627ad7e8d542f367baee55a9a
7
+ data.tar.gz: 63b21b5c765c7a58db62c91e4ea1474ce3da2613a21246235106ed888375274cb792077caff9c3efb3c6faf3aa34c49cc56528723848fd41f532a4507e717ee7
data/lib/rudash.rb CHANGED
@@ -52,6 +52,7 @@ require_relative './rudash/chain.rb'
52
52
  require_relative './rudash/flow.rb'
53
53
  require_relative './rudash/flow_right.rb'
54
54
  require_relative './rudash/unset.rb'
55
+ require_relative './rudash/nth.rb'
55
56
 
56
57
  ### Utils Requires
57
58
  require_relative './utils/index.rb'
@@ -121,6 +122,7 @@ class R_
121
122
  extend Rudash::Flow
122
123
  extend Rudash::FlowRight
123
124
  extend Rudash::Unset
125
+ extend Rudash::Nth
124
126
  end
125
127
 
126
128
  # rubocop:enable Naming/ClassAndModuleCamelCase
data/lib/rudash/nth.rb ADDED
@@ -0,0 +1,11 @@
1
+ module Rudash
2
+ module Nth
3
+ def nth(array, *rest_args)
4
+ n = self.head(rest_args) || 0
5
+ return self.nth(array, 0) unless self.number?(n)
6
+ return nil unless self.array?(array)
7
+
8
+ array[n]
9
+ end
10
+ end
11
+ end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rudash
2
- VERSION = '3.0.7'.freeze
2
+ VERSION = '3.1.0'.freeze
3
3
  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: 3.0.7
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Islam Attrash
@@ -51,6 +51,7 @@ files:
51
51
  - lib/rudash/map.rb
52
52
  - lib/rudash/negate.rb
53
53
  - lib/rudash/nil.rb
54
+ - lib/rudash/nth.rb
54
55
  - lib/rudash/number.rb
55
56
  - lib/rudash/pick.rb
56
57
  - lib/rudash/range.rb