Module: CurationConcerns::CollectionBehavior
- Extended by:
- ActiveSupport::Concern
- Includes:
- HasRepresentative, HumanReadableType, Noid, Permissions, Hydra::AccessControls::WithAccessRight, Hydra::Collection
- Included in:
- Collection
- Defined in:
- app/models/concerns/curation_concerns/collection_behavior.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #add_member(collectible) ⇒ Object
- #bytes ⇒ Object
- #can_be_member_of_collection?(collection) ⇒ Boolean
- #to_s ⇒ Object
Methods included from Permissions::Readable
#private?, #public?, #registered?
Methods included from Permissions::Writable
#paranoid_edit_permissions, #paranoid_permissions
Methods included from HumanReadableType
#human_readable_type, #to_solr
Methods included from Noid
Instance Method Details
#add_member(collectible) ⇒ Object
16 17 18 19 20 |
# File 'app/models/concerns/curation_concerns/collection_behavior.rb', line 16 def add_member(collectible) return unless can_add_to_members?(collectible) members << collectible save end |
#bytes ⇒ Object
26 27 28 |
# File 'app/models/concerns/curation_concerns/collection_behavior.rb', line 26 def bytes members.reduce(0) { |sum, gf| sum + gf.content.size.to_i } end |
#can_be_member_of_collection?(collection) ⇒ Boolean
30 31 32 |
# File 'app/models/concerns/curation_concerns/collection_behavior.rb', line 30 def can_be_member_of_collection?(collection) collection != self end |
#to_s ⇒ Object
22 23 24 |
# File 'app/models/concerns/curation_concerns/collection_behavior.rb', line 22 def to_s title.present? ? title : 'No Title' end |