class BPL::Derivatives::DatastreamDecorator

Attributes

source_datastream[RW]

Public Class Methods

new(object, source_datastream_name) click to toggle source
Calls superclass method
# File lib/bpl/derivatives/datastream_decorator.rb, line 5
def initialize(object, source_datastream_name)
  super(object)
  self.source_datastream = object.send(source_datastream_name)
end

Public Instance Methods

content() click to toggle source
# File lib/bpl/derivatives/datastream_decorator.rb, line 10
def content
  self.source_datastream.content
end
filename_for_characterization() click to toggle source
# File lib/bpl/derivatives/datastream_decorator.rb, line 18
def filename_for_characterization
  return source_datastream.filename_for_characterization if source_datastream.respond_to?(:filename_for_characterization)
  self.default_filename_for_charaterization
end
has_content?() click to toggle source
# File lib/bpl/derivatives/datastream_decorator.rb, line 14
def has_content?
  self.source_datastream.has_content?
end

Protected Instance Methods

default_filename_for_charaterization() click to toggle source
# File lib/bpl/derivatives/datastream_decorator.rb, line 24
def default_filename_for_charaterization
  registered_mime_type = BPL::Derivatives::MimeTypeService.type_lookup(source_datastream.mimeType)
  BPL::Derivatives.base_logger.warn "Unable to find a registered mime type for #{source_datastream.mimeType.inspect} on #{pid}" unless registered_mime_type
  extension = registered_mime_type ? ".#{registered_mime_type.extensions.first}" : ''
  ["#{source_datastream.pid}-#{source_datastream.dsVersionID}", "#{extension}"]
end