Module: PrimeProducts::CLI
- Defined in:
- lib/prime_products/cli.rb
Constant Summary collapse
- DEFAULT_NUMBER_OF_PRIMES =
10
Class Method Summary collapse
-
.call(output: $stdout, arguments: ARGV) ⇒ Object
Generates a multiplication table of the first N primes (specified by a command line argument by default) and outputs it to the specified output (‘STDOUT by default).
Class Method Details
.call(output: $stdout, arguments: ARGV) ⇒ Object
Generates a multiplication table of the first N primes (specified by a command line argument by default) and outputs it to the specified output (‘STDOUT by default).
14 15 16 17 18 |
# File 'lib/prime_products/cli.rb', line 14 def self.call(output: $stdout, arguments: ARGV) number_of_primes = arguments[0]&.to_i || DEFAULT_NUMBER_OF_PRIMES output.puts PrimeProducts.generate_table(number_of_primes: number_of_primes) end |