class PIM::Importer::ImportHandler

Attributes

chunk_nr[R]
chunk_offset[R]
chunk_size[R]
content_type[R]
context[R]
import_summary_id[R]
input_size[R]
input_stream[R]
media_type[R]
path[R]

Public Class Methods

new(content_type, path, input_stream, input_size, context) click to toggle source
# File importer.rb, line 30
def initialize content_type, path, input_stream, input_size, context
  @content_type = content_type
  @path = path
  @input_stream = input_stream
  @input_size = input_size
  @context = context
  @import_summary_id = context[:import_summary_id]
  @import_asset = context[:import_asset]
  @media_type = context[:media_type]
  @chunk_nr = context[:chunk_nr]
  @chunk_size = context[:chunk_size]
  @chunk_offset = context[:chunk_offset]
end

Public Instance Methods

delegate_import(*handler_classes) click to toggle source
# File importer.rb, line 53
def delegate_import *handler_classes
  handler_classes.flatten.each do |handler_class|
    next if not handler_class <= ImportHandler
    reload_import_asset
    handler = handler_class.new(content_type, path, input_stream, input_size, context);
    if handler.import
      return true
    end
  end
  return false
end
import(&block) click to toggle source
# File importer.rb, line 49
def import &block
  self.instance_exec(&block) if block
end
media_type_param(key) click to toggle source
# File importer.rb, line 44
def media_type_param key
  media_type = context[:media_type]
  return media_type.parameters[key] if media_type
end