Module: Hydra::PCDM::PcdmBehavior
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/hydra/pcdm/models/concerns/pcdm_behavior.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #ancestor?(potential_ancestor) ⇒ Boolean
- #in_collection_ids ⇒ Object
- #in_collections ⇒ Object
- #member_of ⇒ Object
- #object_ids ⇒ Object
- #objects ⇒ Object
- #ordered_member_ids ⇒ Object
- #ordered_object_ids ⇒ Object
- #ordered_objects ⇒ Object
Instance Method Details
#ancestor?(potential_ancestor) ⇒ Boolean
59 60 61 |
# File 'lib/hydra/pcdm/models/concerns/pcdm_behavior.rb', line 59 def ancestor?(potential_ancestor) ::Hydra::PCDM::AncestorChecker.former_is_ancestor_of_latter?(potential_ancestor, self) end |
#in_collection_ids ⇒ Object
55 56 57 |
# File 'lib/hydra/pcdm/models/concerns/pcdm_behavior.rb', line 55 def in_collection_ids in_collections.map(&:id) end |
#in_collections ⇒ Object
51 52 53 |
# File 'lib/hydra/pcdm/models/concerns/pcdm_behavior.rb', line 51 def in_collections member_of.select(&:pcdm_collection?).to_a end |
#member_of ⇒ Object
26 27 28 29 |
# File 'lib/hydra/pcdm/models/concerns/pcdm_behavior.rb', line 26 def member_of return [] if id.nil? ActiveFedora::Base.where(Config.indexing_member_ids_key => id) end |
#object_ids ⇒ Object
39 40 41 |
# File 'lib/hydra/pcdm/models/concerns/pcdm_behavior.rb', line 39 def object_ids objects.map(&:id) end |
#objects ⇒ Object
35 36 37 |
# File 'lib/hydra/pcdm/models/concerns/pcdm_behavior.rb', line 35 def objects members.select(&:pcdm_object?) end |
#ordered_member_ids ⇒ Object
31 32 33 |
# File 'lib/hydra/pcdm/models/concerns/pcdm_behavior.rb', line 31 def ordered_member_ids ordered_member_proxies.map(&:target_id) end |
#ordered_object_ids ⇒ Object
47 48 49 |
# File 'lib/hydra/pcdm/models/concerns/pcdm_behavior.rb', line 47 def ordered_object_ids ordered_objects.map(&:id) end |
#ordered_objects ⇒ Object
43 44 45 |
# File 'lib/hydra/pcdm/models/concerns/pcdm_behavior.rb', line 43 def ordered_objects ordered_members.to_a.select(&:pcdm_object?) end |