Class: Grumlin::QueryValidators::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/grumlin/query_validators/validator.rb

Direct Known Subclasses

BlocklistedStepsValidator

Defined Under Namespace

Classes: ValidationError

Instance Method Summary collapse

Instance Method Details

#valid?(steps) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/grumlin/query_validators/validator.rb', line 21

def valid?(steps)
  errors(steps).empty?
end

#validate!(steps) ⇒ Object

steps is an instance of ‘Steps` after shortcuts applied

Raises:



15
16
17
18
19
# File 'lib/grumlin/query_validators/validator.rb', line 15

def validate!(steps)
  return unless (err = errors(steps)).any?

  raise ValidationError.new(steps, err)
end