Module: Hydra::Works::WorkBehavior
- Extended by:
- ActiveSupport::Concern, Deprecation
- Included in:
- Work
- Defined in:
- lib/hydra/works/models/concerns/work_behavior.rb
Overview
This module provides all of the Behaviors of a Hydra::Works::Work
behavior:
1) Hydra::Works::Work can aggregate Hydra::Works::Work
2) Hydra::Works::Work can aggregate Hydra::Works::FileSet
3) Hydra::Works::Work can NOT aggregate Hydra::PCDM::Collection
4) Hydra::Works::Work can NOT aggregate Hydra::Works::Collection
5) Hydra::Works::Work can NOT aggregate Works::Object unless it is also a Hydra::Works::FileSet
6) Hydra::Works::Work can NOT contain PCDM::File
7) Hydra::Works::Work can NOT aggregate non-PCDM object
8) Hydra::Works::Work can NOT contain Hydra::Works::FileSet
9) Hydra::Works::Work can have descriptive metadata
10) Hydra::Works::Work 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.
- #file_set_ids ⇒ Object
- #file_sets ⇒ Object
- #in_works ⇒ Object
- #ordered_file_set_ids ⇒ Object
- #ordered_file_sets ⇒ Object
- #ordered_work_ids ⇒ Object
- #ordered_works ⇒ Object
-
#work? ⇒ Boolean
Whether this instance is a Hydra::Works Generic Work.
- #work_ids ⇒ Object
- #works ⇒ Object
Instance Method Details
#collection? ⇒ Boolean
Returns whether this instance is a Hydra::Works Collection.
67 68 69 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 67 def collection? false end |
#file_set? ⇒ Boolean
Returns whether this instance is a Hydra::Works::FileSet.
77 78 79 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 77 def file_set? false end |
#file_set_ids ⇒ Object
52 53 54 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 52 def file_set_ids file_sets.map(&:id) end |
#file_sets ⇒ Object
48 49 50 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 48 def file_sets members.select(&:file_set?) end |
#in_works ⇒ Object
81 82 83 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 81 def in_works ordered_by.select { |parent| parent.class.included_modules.include?(Hydra::Works::WorkBehavior) }.to_a end |
#ordered_file_set_ids ⇒ Object
61 62 63 64 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 61 def ordered_file_set_ids Deprecation.warn WorkBehavior, "ordered_file_set_ids is deprecated and will be removed in Hydra::Works 1.0. If you need order, use an interstitial work node." ordered_file_sets.map(&:id) end |
#ordered_file_sets ⇒ Object
56 57 58 59 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 56 def ordered_file_sets Deprecation.warn WorkBehavior, "ordered_file_sets is deprecated and will be removed in Hydra::Works 1.0. If you need order, use an interstitial work node." ordered_members.to_a.select(&:file_set?) end |
#ordered_work_ids ⇒ Object
44 45 46 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 44 def ordered_work_ids ordered_works.map(&:id) end |
#ordered_works ⇒ Object
40 41 42 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 40 def ordered_works ordered_members.to_a.select(&:work?) end |
#work? ⇒ Boolean
Returns whether this instance is a Hydra::Works Generic Work.
72 73 74 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 72 def work? true end |
#work_ids ⇒ Object
36 37 38 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 36 def work_ids works.map(&:id) end |
#works ⇒ Object
32 33 34 |
# File 'lib/hydra/works/models/concerns/work_behavior.rb', line 32 def works members.select(&:work?) end |