Sha256: 997ea24318bfb4b06bfd5e1b11613c86f5ba471676a5d2c384a7da155cb3d6c1

Contents?: true

Size: 912 Bytes

Versions: 10

Compression:

Stored size: 912 Bytes

Contents

module Ddr::Models
  module Captionable
    extend ActiveSupport::Concern

    included do
      has_file_datastream name: Ddr::Datastreams::CAPTION,
                          type: Ddr::Datastreams::CaptionDatastream,
                          versionable: true,
                          label: "Caption file for this object",
                          control_group: "E"
    end

    def caption_type
      datastreams[Ddr::Datastreams::CAPTION].mimeType
    end

    def caption_extension
      extensions = Ddr::Models.preferred_file_extensions
      if extensions.include? caption_type
        extensions[caption_type]
      else
        caption_extension_default
      end
    end

    def caption_path
      datastreams[Ddr::Datastreams::CAPTION].file_path
    end

    private
    
    def caption_extension_default
      datastreams[Ddr::Datastreams::CAPTION].default_file_extension
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ddr-models-2.11.0 lib/ddr/models/captionable.rb
ddr-models-2.10.2 lib/ddr/models/captionable.rb
ddr-models-2.10.1 lib/ddr/models/captionable.rb
ddr-models-2.10.0 lib/ddr/models/captionable.rb
ddr-models-2.10.0.rc2 lib/ddr/models/captionable.rb
ddr-models-2.10.0.rc1 lib/ddr/models/captionable.rb
ddr-models-2.9.2 lib/ddr/models/captionable.rb
ddr-models-2.9.1 lib/ddr/models/captionable.rb
ddr-models-2.9.0 lib/ddr/models/captionable.rb
ddr-models-2.9.0.rc1 lib/ddr/models/captionable.rb