Module: PgExport::Roles::Validatable
- Included in:
- PgExport
- Defined in:
- lib/pg_export/roles/validatable.rb
Constant Summary collapse
- VALID_NON_EMPTY_STRING =
Strict::String.constrained(min_size: 1)
- VALID_POSITIVE_INTEGER =
Strict::Int.constrained(gteq: 0)
Instance Method Summary collapse
Instance Method Details
#validate_database_name(database) ⇒ Object
11 12 13 14 15 |
# File 'lib/pg_export/roles/validatable.rb', line 11 def validate_database_name(database) VALID_NON_EMPTY_STRING[database] rescue Dry::Types::ConstraintError raise ArgumentError, 'The "database" parameter has to be a valid, non-empty string' end |
#validate_keep_dumps(keep_dumps) ⇒ Object
17 18 19 20 21 |
# File 'lib/pg_export/roles/validatable.rb', line 17 def validate_keep_dumps(keep_dumps) VALID_POSITIVE_INTEGER[keep_dumps] rescue Dry::Types::ConstraintError raise ArgumentError, 'The "keep_dumps" parameter has to be a valid, non-negative integer' end |