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

Instance Method Details

#collection?Boolean

Returns whether this instance is a Hydra::Works Collection.

Returns:

  • (Boolean)

    whether this instance is a Hydra::Works Collection.



48
49
50
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 48

def collection?
  true
end

#file_set?Boolean

Returns whether this instance is a Hydra::Works::FileSet.

Returns:

  • (Boolean)

    whether this instance is a Hydra::Works::FileSet.



58
59
60
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 58

def file_set?
  false
end

#ordered_work_idsObject



35
36
37
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 35

def ordered_work_ids
  ordered_works.map(&:id)
end

#ordered_worksObject



31
32
33
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 31

def ordered_works
  ordered_members.to_a.select(&:work?)
end

#work?Boolean

Returns whether this instance is a Hydra::Works Generic Work.

Returns:

  • (Boolean)

    whether this instance is a Hydra::Works Generic Work.



53
54
55
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 53

def work?
  false
end

#work_idsObject



43
44
45
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 43

def work_ids
  works.map(&:id)
end

#worksObject



39
40
41
# File 'lib/hydra/works/models/concerns/collection_behavior.rb', line 39

def works
  members.select(&:work?)
end