Class: PrintPrimesTable::Validators::HelpValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/print_primes_table/validators/help_validator.rb

Overview

to validate the –help option

Author:

  • Diego Hernán Piccinini Lagos

Class Method Summary collapse

Class Method Details

.validate(args) ⇒ Symbol | String

validate the arguments of –help option

Parameters:

  • args (Array)

    the help option hasn’t arguments

Returns:

  • (Symbol | String)

    :valid or an Error Message



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/print_primes_table/validators/help_validator.rb', line 13

def validate(args)
  begin
    raise ArgumentError.new(
      ErrorMessage.new(:command_wrong_arguments,
        {:max => 1, :argument_num => args.count }
        ).show_content) if args.count > 0

    :valid
  rescue  => err
    err.message
  end
end