Sha256: ac342afdc7fbc4cec00259f9b279057a72c7e850e6f88259604c3ea17504e53e

Contents?: true

Size: 1023 Bytes

Versions: 10

Compression:

Stored size: 1023 Bytes

Contents

module Ddr::Models
  module Streamable
    extend ActiveSupport::Concern

    included do
      has_file_datastream name: Ddr::Datastreams::STREAMABLE_MEDIA,
                          type: Ddr::Datastreams::StreamableMediaDatastream,
                          versionable: true,
                          label: "Streamable media file for this object",
                          control_group: "E"
    end

    def streamable_media_type
      datastreams[Ddr::Datastreams::STREAMABLE_MEDIA].mimeType
    end

    def streamable_media_extension
      extensions = Ddr::Models.preferred_file_extensions
      if extensions.include? streamable_media_type
        extensions[streamable_media_type]
      else
        streamable_media_extension_default
      end
    end

    def streamable_media_path
      datastreams[Ddr::Datastreams::STREAMABLE_MEDIA].file_path
    end

    private

    def streamable_media_extension_default
      datastreams[Ddr::Datastreams::STREAMABLE_MEDIA].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/streamable.rb
ddr-models-2.10.2 lib/ddr/models/streamable.rb
ddr-models-2.10.1 lib/ddr/models/streamable.rb
ddr-models-2.10.0 lib/ddr/models/streamable.rb
ddr-models-2.10.0.rc2 lib/ddr/models/streamable.rb
ddr-models-2.10.0.rc1 lib/ddr/models/streamable.rb
ddr-models-2.9.2 lib/ddr/models/streamable.rb
ddr-models-2.9.1 lib/ddr/models/streamable.rb
ddr-models-2.9.0 lib/ddr/models/streamable.rb
ddr-models-2.9.0.rc1 lib/ddr/models/streamable.rb