module PaperclipArchiveProcessor::Processor

Public Class Methods

extract(attachment) click to toggle source
# File lib/paperclip_archive_processor/processor.rb, line 7
def self.extract(attachment)
  extractor = PaperclipArchiveProcessor::Extractor.extractor_for(attachment.content_type)
  processor = processor_for(attachment)
  processor.extract(attachment, extractor)
end

Private Class Methods

processor_for(attachment) click to toggle source
# File lib/paperclip_archive_processor/processor.rb, line 15
def self.processor_for(attachment)
  storage_class_name = attachment.instance_variable_get(:@storage).to_s.capitalize
  begin
    PaperclipArchiveProcessor::Processor.const_get(storage_class_name)
  rescue NameError
    raise StorageMethodNotFound, "Cannot load storage module '#{storage_class_name}'"
  end
end