ruby-mext 0.15.0 → 0.15.1

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: '09ac64d0fe860b273907466ffa0f6a4662b7210f0822a190820d69a5aaf3f51e'
4
- data.tar.gz: 5c5d520e102f656a1dea652fd07282453d6af3c70e02d46cf4e3d3146fabd547
3
+ metadata.gz: 28a4013db3acd54130cea14908a473af1995e6305dc076f745c0df0fd39fee4e
4
+ data.tar.gz: 3d000b5df323a872be365c786066f8a9aee8e24b37945846ed8846a5dca034d0
5
5
  SHA512:
6
- metadata.gz: 647018fa06c2ed3161e6f6f21ab5a0903b4e1e964475dacbe380609d5c23a87ffa0679e7edec9326d75a24ba662bc0b5939e6d9b3d206c9f0172c63e0bb60a3f
7
- data.tar.gz: a46cb682b5aa14dbd7c36451711b72089327e4b198035662a0467fb990380cbdb7d113a783eea62b9ec303b9f5418604c879c8beda1917e82a65c1a87f6d6b11
6
+ metadata.gz: 9cba68333d146085b14fc491fe4faf5843a8ffced4bfc0528f738a51beb7100f5b7327a4ab2ee222ff0b96be9ba45ce7f7102289f556697be960b8b56f6d038c
7
+ data.tar.gz: da29c1c57a3868fc95c6ebbebeaa71775c2587d5a3aade044c4a9d8592488a7e5ade59b5c0f63e16f78c78cf852b8904e62818bcf711ff868f786e5921200ff7
@@ -23,6 +23,17 @@ module Mext
23
23
  @cur = @restart_value = rv
24
24
  end
25
25
 
26
+ #
27
+ # +peek_next(step = 1)+
28
+ #
29
+ # checks the next value contained in the array without bumping
30
+ # the index
31
+ #
32
+ def peek_next(step = 1)
33
+ idx = next_index(step)
34
+ self[idx]
35
+ end
36
+
26
37
  #
27
38
  # +next(step = 1)+
28
39
  #
@@ -31,8 +42,7 @@ module Mext
31
42
  #
32
43
  def next(step = 1)
33
44
  res = self.current
34
- @cur += step
35
- @cur = [self.cur % self.size, self.restart_value].max
45
+ @cur = next_index(step)
36
46
  res
37
47
  end
38
48
 
@@ -96,6 +106,12 @@ module Mext
96
106
 
97
107
  end
98
108
 
109
+ private
110
+
111
+ def next_index(step = 1)
112
+ [(self.cur + step) % self.size, self.restart_value].max
113
+ end
114
+
99
115
  end
100
116
 
101
117
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mext
2
- VERSION = '0.15.0'
2
+ VERSION = '0.15.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-mext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicola Bernardini
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-14 00:00:00.000000000 Z
11
+ date: 2019-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler