Refractor Factory 4/4: clarifications


Okay, so I know that this whole lesson is very buggy but I did decide to continue and research any new terms I did not understand and also try to understand why the code ran the way it did and why it was done the way it was done BUT I do want to make sure that I have the following lines understood:18%20PM

Just to clarify, and are both OBSOLETE and no longer used in Ruby, which is why the lesson is being so buggy.

The next thing is trying to make sure I completely understand what is going on with
require ‘prime’

require ‘prime’:
This is receiving a module called Prime and giving us access its algorithm, which only picks prime numbers. We are able to call this module as many times as we want since ‘require’ receives an object and makes it so it doesn’t have to keep doing it.
Can ‘require’ be simplified down to this?: once in, always in until the program stops running.

In combo with ‘Prime’, the method ‘.first()’ just displays the first (n) elements of the ‘Prime’ array.

So overall, these are what I’m trying to get clarified.
I’m just trying to make the best of a messy situation so I hope I, somewhat, got it down lol


Once in memory, there is no limit to how many times the Prime class is instantiated. The module is present until the session is ended.

For convenience, each instance method of Prime .instance can be accessed as a class method of Prime .


Prime is not a stored array. It is computed with each new instantantiation. Given that there are infinitely many primes, it follows we would favor the computational approach when handling queries. We are not polling a reference.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.