I wasn’t getting any errors or results trying to run the refactored code in the browser so I went local on my Mac and was seeing an error:
first_n_primes.rb:8:in `first_n_primes': private method `new' called for Prime:Class (NoMethodError) from first_n_primes.rb:13:in `<main>'
I eventually came across this article, but it is closed: Prime.new and Prime.next obsolete in Ruby >2.2
Anyway, there was a Stack Overflow link there which lead me to the solution and the correct usage of the prime module, if you’re running it locally and using a version newer than 1.9 (I’m on 2.3.3p222). If you’re also trying to run code locally and on a version newer than 1.9 change the following lines:
prime = Prime.new
prime = Prime::EratosthenesGenerator.new