Sha256: ed311f552071461bf780217fcd2d14931af038f1336a3b962033ddc8076e2060

Contents?: true

Size: 465 Bytes

Versions: 17

Compression:

Stored size: 465 Bytes

Contents

module Hydra::PCDM::Validators
  class AncestorValidator
    def self.validate!(association, record)
      new(association.owner, record).validate!
    end

    attr_reader :owner, :record
    def initialize(owner, record)
      @owner = owner
      @record = record
    end

    def validate!
      return unless owner.ancestor?(record)
      raise ArgumentError, "#{record.class} with ID: #{record.id} failed to pass AncestorChecker validation"
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
hydra-pcdm-1.4.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-1.3.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-1.2.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-1.1.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-1.0.1 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-1.0.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-0.11.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-0.10.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-0.9.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-0.8.2 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-0.8.1 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-0.8.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-0.8.0.beta1 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-0.7.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-0.6.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-0.5.0 lib/hydra/pcdm/validators/ancestor_validator.rb
hydra-pcdm-0.4.0 lib/hydra/pcdm/validators/ancestor_validator.rb