Sha256: b9d8e3155223019ca9f1f4ba1a7922519a98117f0c4238c7e99d6b83cc8b4db9
Contents?: true
Size: 1.82 KB
Versions: 8
Compression:
Stored size: 1.82 KB
Contents
module ActiveFedora class Base def can_have_attachments? has_association? :attachments end def has_attachments? can_have_attachments? && attachments.size > 0 end def can_have_children? has_association? :children end def has_children? can_have_children? and children.size > 0 end def can_have_content? datastreams.include? "content" end def has_content? can_have_content? && content.has_content? end def describable? self.is_a? Ddr::Models::Describable end def governable? has_association? :admin_policy end def has_admin_policy? governable? && admin_policy.present? end def can_have_struct_metadata? datastreams.include? Ddr::Datastreams::STRUCT_METADATA end def has_struct_metadata? can_have_struct_metadata? && structMetadata.has_content? end def can_have_intermediate_file? datastreams.include? Ddr::Datastreams::INTERMEDIATE_FILE end def has_intermediate_file? can_have_intermediate_file? && datastreams[Ddr::Datastreams::INTERMEDIATE_FILE].has_content? end def can_have_multires_image? datastreams.include? Ddr::Datastreams::MULTIRES_IMAGE end def has_multires_image? can_have_multires_image? && datastreams[Ddr::Datastreams::MULTIRES_IMAGE].has_content? end def can_have_thumbnail? datastreams.include? "thumbnail" end def has_thumbnail? can_have_thumbnail? && thumbnail.has_content? end def safe_id id.sub(/:/, "-") end # For duck-typing with SolrDocument def active_fedora_model self.class.to_s end def controller_name active_fedora_model.tableize end protected def has_association? assoc !association(assoc).nil? end end end
Version data entries
8 entries across 8 versions & 1 rubygems