Class: Ronin::App::Validations::InstallRepoParams

Inherits:
Dry::Validation::Contract
  • Object
show all
Defined in:
lib/ronin/app/validations/install_repo_params.rb

Overview

Validations for form params submitted to POST /repos/install.

Constant Summary collapse

URI_REGEX =

Regular expression that matches https://, http://, ssh://, and git:// URIs.

URI::DEFAULT_PARSER.make_regexp(%w[https http git ssh])
GIT_URI_REGEX =

Regular expression that matches both https:// URIs and git@host.com:path/to/repo.git URIs.

%r{\A(?:#{URI_REGEX}|[^@]+@[A-Za-z0-9._-]+(?::\d+)?:[A-Za-z0-9./_-]+)\z}
NAME_REGEX =

Regular expression that matches an alpha-numeric name containing dashes and/or underscores.

/\A[A-Za-z0-9_-]+\z/

Class Method Summary collapse

Class Method Details

.call(params) ⇒ Dry::Validation::Result

Initializes and calls the validation contract.

Parameters:

  • params (Hash{String => Object})

    The HTTP params to validate.

Returns:

  • (Dry::Validation::Result)

    The validation result.



71
72
73
# File 'lib/ronin/app/validations/install_repo_params.rb', line 71

def self.call(params)
  new.call(params)
end