Class: Paperclip::Document::Processor

Inherits:
Processor
  • Object
show all
Defined in:
lib/paperclip/document/processor.rb

Overview

Main processor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, options = {}, attachment = nil) ⇒ Processor

Returns a new instance of Processor.



9
10
11
12
13
# File 'lib/paperclip/document/processor.rb', line 9

def initialize(file, options = {}, attachment = nil)
  super(file, options, attachment)
  @instance = @attachment.instance
  @tmp_dir = Pathname.new(Dir.tmpdir).join("paperclip-document-" + Time.now.to_i.to_s(36) + rand(1_000_000_000).to_s(36))
end

Instance Attribute Details

#instanceObject (readonly)

Returns the value of attribute instance.



7
8
9
# File 'lib/paperclip/document/processor.rb', line 7

def instance
  @instance
end

#tmp_dirObject (readonly)

Returns the value of attribute tmp_dir.



7
8
9
# File 'lib/paperclip/document/processor.rb', line 7

def tmp_dir
  @tmp_dir
end

Instance Method Details

#basenameObject



19
20
21
# File 'lib/paperclip/document/processor.rb', line 19

def basename
  file_path.basename.to_s.gsub(/\.[^\.]+/, '')
end

#file_pathObject



15
16
17
# File 'lib/paperclip/document/processor.rb', line 15

def file_path
  Pathname.new(@file.path)
end