class Prime::EratosthenesGenerator
An implementation of PseudoPrimeGenerator
.
Uses EratosthenesSieve
.
Public Class Methods
new()
click to toggle source
Calls superclass method
Prime::PseudoPrimeGenerator.new
# File lib/prime.rb, line 308 def initialize @last_prime = nil super end
Public Instance Methods
rewind()
click to toggle source
# File lib/prime.rb, line 316 def rewind initialize end
succ()
click to toggle source
# File lib/prime.rb, line 313 def succ @last_prime = @last_prime ? EratosthenesSieve.instance.next_to(@last_prime) : 2 end
Also aliased as: next