Sha256: 919dcf716a760bb035a3efb9c03199dbab11ef55be7c683ad957298e5ea03f68

Contents?: true

Size: 670 Bytes

Versions: 15

Compression:

Stored size: 670 Bytes

Contents

module Hydra::PCDM
  ##
  # Checks whether or not one object is an ancestor of another.
  module AncestorChecker
    # @param options [Hash]
    # @option record [#pcdm_behavior?]
    # @option potential_ancestor [#pcdm_behavior?]
    # @return Boolean
    def self.former_is_ancestor_of_latter?(potential_ancestor, record)
      return true if record == potential_ancestor
      return false unless potential_ancestor.respond_to?(:members)
      return true if Array.wrap(potential_ancestor.members).detect { |member| former_is_ancestor_of_latter?(member, record) }
      false
    end
    class << self
      alias call former_is_ancestor_of_latter?
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

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