Method: Console1984::CommandValidator#validate

Defined in:
lib/console1984/command_validator.rb

#validate(command) ⇒ Object

Executes the chain of validations passing a parsed command created with the command string passed by parameter.

The validations are executed in the order they were added. If one validation raises an error, the error will raise and the rest of validations won’t get checked.



61
62
63
64
65
66
67
# File 'lib/console1984/command_validator.rb', line 61

def validate(command)
  parsed_command = ParsedCommand.new(command)

  validations_by_name.values.each do |validation|
    validation.validate(parsed_command)
  end
end