module Hydra::PCDM::AncestorChecker

Checks whether or not one object is an ancestor of another.

Public Class Methods

call(potential_ancestor, record)
former_is_ancestor_of_latter?(potential_ancestor, record) click to toggle source

@param options [Hash] @option record [#pcdm_behavior?] @option potential_ancestor [#pcdm_behavior?] @return Boolean

# File lib/hydra/pcdm/ancestor_checker.rb, line 9
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
Also aliased as: call