Sha256: e508185ebb6b6ef09be333fcdf8dc8d6c98acbff53b08e04177ac1fe4de87b1f

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

module GeoWorks
  # Attributes and methods for image works
  module ImageWorkBehavior
    extend ActiveSupport::Concern
    include ::GeoWorks::MetadataExtractionHelper

    included do
      type [Hydra::PCDM::Vocab::PCDMTerms.Object,
            Hydra::Works::Vocab::WorksTerms.GenericWork,
            ::GeoWorks::GeoTerms.ImageWork]
    end

    def image_file
      members.select(&:image_file?).to_a.first
    end

    def metadata_files
      members.select(&:external_metadata_file?)
    end

    def raster_works
      members.select(&:raster_work?)
    end

    # Defines type by what it is and isn't

    # This is an Image Resource
    # @return [Boolean]
    def image_work?
      true
    end

    # This is not an ImageFile Resource
    # @return [Boolean]
    def image_file?
      false
    end

    # This is not an ImageFile Resource
    # @return [Boolean]
    def raster_work?
      false
    end

    # This is not an ImageFile Resource
    # @return [Boolean]
    def raster_file?
      false
    end

    # This is not an ImageFile Resource
    # @return [Boolean]
    def vector_work?
      false
    end

    # This is not an ImageFile Resource
    # @return [Boolean]
    def vector_file?
      false
    end

    # This is not an ExternalMetadataFile Resource
    # @return [Boolean]
    def external_metadata_file?
      false
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
geo_works-0.2.0 app/models/concerns/geo_works/image_work_behavior.rb
geo_works-0.1.4 app/models/concerns/geo_works/image_work_behavior.rb
geo_works-0.1.3 app/models/concerns/geo_works/image_work_behavior.rb
geo_works-0.1.2 app/models/concerns/geo_works/image_work_behavior.rb
geo_works-0.1.1 app/models/concerns/geo_works/image_work_behavior.rb
geo_works-0.1.0 app/models/concerns/geo_works/image_work_behavior.rb