Class: Paperclip::Document::Processor
- Inherits:
-
Processor
- Object
- Processor
- Paperclip::Document::Processor
- Defined in:
- lib/paperclip/document/processor.rb
Overview
Main processor
Direct Known Subclasses
Paperclip::Document::Processors::Counter, Paperclip::Document::Processors::Freezer, Paperclip::Document::Processors::Reader, Paperclip::Document::Processors::Sketcher
Instance Attribute Summary collapse
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
-
#tmp_dir ⇒ Object
readonly
Returns the value of attribute tmp_dir.
Instance Method Summary collapse
- #basename ⇒ Object
- #file_path ⇒ Object
-
#initialize(file, options = {}, attachment = nil) ⇒ Processor
constructor
A new instance of Processor.
Constructor Details
#initialize(file, options = {}, attachment = nil) ⇒ Processor
Returns a new instance of Processor.
7 8 9 10 11 |
# File 'lib/paperclip/document/processor.rb', line 7 def initialize(file, = {}, = nil) super(file, , ) @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
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
5 6 7 |
# File 'lib/paperclip/document/processor.rb', line 5 def instance @instance end |
#tmp_dir ⇒ Object (readonly)
Returns the value of attribute tmp_dir.
5 6 7 |
# File 'lib/paperclip/document/processor.rb', line 5 def tmp_dir @tmp_dir end |
Instance Method Details
#basename ⇒ Object
17 18 19 |
# File 'lib/paperclip/document/processor.rb', line 17 def basename file_path.basename.to_s.gsub(/\.[^\.]+/, '') end |
#file_path ⇒ Object
13 14 15 |
# File 'lib/paperclip/document/processor.rb', line 13 def file_path Pathname.new(@file.path) end |