Sha256: 83546727074d99a1dc18c14f8a68054983dd40bfcbf69613fb491a8a64b587ca
Contents?: true
Size: 684 Bytes
Versions: 15
Compression:
Stored size: 684 Bytes
Contents
# frozen_string_literal: true class Grumlin::QueryValidators::Validator class ValidationError < Grumlin::Error attr_reader :errors, :steps def initialize(steps, errors) super("Query is invalid: #{errors}") @steps = steps @errors = errors end end # steps is an instance of `Steps` after shortcuts applied def validate!(steps) return unless (err = errors(steps)).any? raise ValidationError.new(steps, err) end def valid?(steps) errors(steps).empty? end protected def errors(steps) {}.tap do |errors| validate(steps, errors) end end def validate(steps, errors) raise NotImplementedError end end
Version data entries
15 entries across 15 versions & 1 rubygems