Module: Hydra::Works::FileSetBehavior
- Extended by:
- ActiveSupport::Concern
- Included in:
- FileSet
- Defined in:
- lib/hydra/works/models/concerns/file_set_behavior.rb
Overview
This module provides all of the Behaviors of a Hydra::Works::GenericFile
behavior:
1) Hydra::Works::FileSet can contain (pcdm:hasFile) Hydra::PCDM::File (inherits from Hydra::PCDM::Object)
2) Hydra::Works::FileSet can contain (pcdm:hasRelatedFile) Hydra::PCDM::File (inherits from Hydra::PCDM::Object)
3) Hydra::Works::FileSet can aggregate (pcdm:hasMember) Hydra::Works::FileSet
4) Hydra::Works::FileSet can NOT aggregate anything other than Hydra::Works::FileSets
5) Hydra::Works::FileSet can have descriptive metadata
6) Hydra::Works::FileSet can have access metadata
Instance Method Summary collapse
-
#collection? ⇒ Boolean
Whether this instance is a Hydra::Works Collection.
-
#file_set? ⇒ Boolean
Whether this instance is a Hydra::Works::FileSet.
- #in_work_ids ⇒ Object
- #in_works ⇒ Object
- #member_of_work_ids ⇒ Object
- #member_of_works ⇒ Object
- #parent_work_ids ⇒ Object
- #parent_works ⇒ Object
-
#work? ⇒ Boolean
Whether this instance is a Hydra::Works Generic Work.
Instance Method Details
#collection? ⇒ Boolean
Returns whether this instance is a Hydra::Works Collection.
32 33 34 |
# File 'lib/hydra/works/models/concerns/file_set_behavior.rb', line 32 def collection? false end |
#file_set? ⇒ Boolean
Returns whether this instance is a Hydra::Works::FileSet.
42 43 44 |
# File 'lib/hydra/works/models/concerns/file_set_behavior.rb', line 42 def file_set? true end |
#in_work_ids ⇒ Object
58 59 60 |
# File 'lib/hydra/works/models/concerns/file_set_behavior.rb', line 58 def in_work_ids in_works.map(&:id) end |
#in_works ⇒ Object
54 55 56 |
# File 'lib/hydra/works/models/concerns/file_set_behavior.rb', line 54 def in_works ordered_by.select { |parent| parent.class.included_modules.include?(Hydra::Works::WorkBehavior) }.to_a end |
#member_of_work_ids ⇒ Object
66 67 68 |
# File 'lib/hydra/works/models/concerns/file_set_behavior.rb', line 66 def member_of_work_ids member_of_works.map(&:id) end |
#member_of_works ⇒ Object
62 63 64 |
# File 'lib/hydra/works/models/concerns/file_set_behavior.rb', line 62 def member_of_works member_of.select(&:work?).to_a end |
#parent_work_ids ⇒ Object
50 51 52 |
# File 'lib/hydra/works/models/concerns/file_set_behavior.rb', line 50 def parent_work_ids in_work_ids + member_of_work_ids end |
#parent_works ⇒ Object
46 47 48 |
# File 'lib/hydra/works/models/concerns/file_set_behavior.rb', line 46 def parent_works in_works + member_of_works end |
#work? ⇒ Boolean
Returns whether this instance is a Hydra::Works Generic Work.
37 38 39 |
# File 'lib/hydra/works/models/concerns/file_set_behavior.rb', line 37 def work? false end |