On this page
class Prime::EratosthenesGenerator
An implementation of PseudoPrimeGenerator
.
Uses EratosthenesSieve
.
Public Class Methods
# File lib/prime.rb, line 313
def initialize
@last_prime_index = -1
super
end
Calls superclass method
Prime::PseudoPrimeGenerator::new
Public Instance Methods
next()
Alias for: succ
# File lib/prime.rb, line 322
def rewind
initialize
end
# File lib/prime.rb, line 318
def succ
@last_prime_index += 1
EratosthenesSieve.instance.get_nth_prime(@last_prime_index)
end
Also aliased as: next
Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.