Sha256: f5ea5ed998ca1a70bb0b88c0bbf6b7b363a7adfc8ffca2115af4da2169a33b66

Contents?: true

Size: 552 Bytes

Versions: 7

Compression:

Stored size: 552 Bytes

Contents

module Hydra::PCDM
  ##
  # Checks whether or not one object is an ancestor of another.
  class AncestorChecker
    attr_reader :record

    # @param [ActiveFedora::Base] record The object which may have ancestors.
    def initialize(record)
      @record = record
    end

    # @param [#members] potential_ancestor Object which may be the ancestor of
    #   the initialized record.
    def ancestor?(potential_ancestor)
      record == potential_ancestor || Hydra::PCDM::DeepMemberIterator.new(potential_ancestor).include?(record)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hydra-pcdm-0.5.0 lib/hydra/pcdm/ancestor_checker.rb
hydra-pcdm-0.4.0 lib/hydra/pcdm/ancestor_checker.rb
hydra-pcdm-0.3.2 lib/hydra/pcdm/ancestor_checker.rb
hydra-pcdm-0.3.1 lib/hydra/pcdm/ancestor_checker.rb
hydra-pcdm-0.3.0 lib/hydra/pcdm/ancestor_checker.rb
hydra-pcdm-0.2.0 lib/hydra/pcdm/ancestor_checker.rb
hydra-pcdm-0.1.0 lib/hydra/pcdm/ancestor_checker.rb