Module: Hydra::Works::CollectionBehavior
- Extended by:
- ActiveSupport::Concern
- Included in:
- Collection
- Defined in:
- lib/hydra/works/models/concerns/collection_behavior.rb
Overview
8) Hydra::Works::Collection can have descriptive metadata
9) Hydra::Works::Collection can have access metadata
Instance Method Summary collapse
- #child_collection_ids ⇒ Object
- #child_collections ⇒ Object
- #child_work_ids ⇒ Object
- #child_works ⇒ Object
-
#collection? ⇒ Boolean
Whether this instance is a Hydra::Works Collection.
-
#file_set? ⇒ Boolean
Whether this instance is a Hydra::Works::FileSet.
- #member_collection_ids ⇒ Object
- #member_collections ⇒ Object
- #member_work_ids ⇒ Object
- #member_works ⇒ Object
- #ordered_work_ids ⇒ Object
- #ordered_works ⇒ Object
- #parent_collection_ids ⇒ Object
- #parent_collections ⇒ Object
-
#work? ⇒ Boolean
Whether this instance is a Hydra::Works Generic Work.
- #work_ids ⇒ Object
- #works ⇒ Object
Instance Method Details
#child_collection_ids ⇒ Object
43 44 45 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 43 def child_collection_ids collection_ids + member_collection_ids end |
#child_collections ⇒ Object
39 40 41 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 39 def child_collections collections + member_collections end |
#child_work_ids ⇒ Object
51 52 53 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 51 def child_work_ids work_ids + member_work_ids end |
#child_works ⇒ Object
47 48 49 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 47 def child_works works + member_works end |
#collection? ⇒ Boolean
Returns whether this instance is a Hydra::Works Collection.
92 93 94 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 92 def collection? true end |
#file_set? ⇒ Boolean
Returns whether this instance is a Hydra::Works::FileSet.
102 103 104 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 102 def file_set? false end |
#member_collection_ids ⇒ Object
77 78 79 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 77 def member_collection_ids member_collections.map(&:id) end |
#member_collections ⇒ Object
71 72 73 74 75 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 71 def member_collections return [] if id.nil? member_objects = ActiveFedora::Base.where('member_of_collection_ids_ssim' => id) member_objects.select(&:collection?).to_a end |
#member_work_ids ⇒ Object
87 88 89 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 87 def member_work_ids member_works.map(&:id) end |
#member_works ⇒ Object
81 82 83 84 85 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 81 def member_works return [] if id.nil? member_objects = ActiveFedora::Base.where('member_of_collection_ids_ssim' => id) member_objects.select(&:work?).to_a end |
#ordered_work_ids ⇒ Object
59 60 61 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 59 def ordered_work_ids ordered_works.map(&:id) end |
#ordered_works ⇒ Object
55 56 57 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 55 def ordered_works ordered_members.to_a.select(&:work?) end |
#parent_collection_ids ⇒ Object
35 36 37 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 35 def parent_collection_ids in_collection_ids + member_of_collection_ids end |
#parent_collections ⇒ Object
31 32 33 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 31 def parent_collections in_collections + member_of_collections end |
#work? ⇒ Boolean
Returns whether this instance is a Hydra::Works Generic Work.
97 98 99 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 97 def work? false end |
#work_ids ⇒ Object
67 68 69 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 67 def work_ids works.map(&:id) end |
#works ⇒ Object
63 64 65 |
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 63 def works members.select(&:work?) end |