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 +4 -4
- data/lib/mext/array/endless_array.rb +18 -2
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28a4013db3acd54130cea14908a473af1995e6305dc076f745c0df0fd39fee4e
|
4
|
+
data.tar.gz: 3d000b5df323a872be365c786066f8a9aee8e24b37945846ed8846a5dca034d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
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.
|
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-
|
11
|
+
date: 2019-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|