Module: Hydra::PCDM::AncestorChecker
- Defined in:
- lib/hydra/pcdm/ancestor_checker.rb
Overview
Checks whether or not one object is an ancestor of another.
Class Method Summary collapse
-
.former_is_ancestor_of_latter?(potential_ancestor, record) ⇒ Boolean
(also: call)
Boolean.
Class Method Details
.former_is_ancestor_of_latter?(potential_ancestor, record) ⇒ Boolean Also known as: call
Returns Boolean.
9 10 11 12 13 14 |
# 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 |