Class: PrintPrimesTable::Options::OnlyPrimesOption
- Inherits:
-
Object
- Object
- PrintPrimesTable::Options::OnlyPrimesOption
- Defined in:
- lib/print_primes_table/options/only_primes_option.rb
Overview
to print only a list of primes collection
Class Method Summary (collapse)
-
+ (Object) process(args, options)
process the input to print the list if it pass the DefaultValidator.validate.
Class Method Details
+ (Object) process(args, options)
process the input to print the list if it pass the DefaultValidator.validate
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/print_primes_table/options/only_primes_option.rb', line 12 def process(args,) validator = Validators::DefaultValidator.validate(args) if validator == :valid if args.count>0 total = Integer(args[0]) primes = Primes.new total else primes= Primes.new end primes.list_numbers else puts validator end end |