Class: PaperclipCompression::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/paperclip-compression/base.rb

Direct Known Subclasses

Jpeg, Png

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, first_processor, options = {}) ⇒ Base

Returns a new instance of Base.



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/paperclip-compression/base.rb', line 4

def initialize(file, first_processor, options = {})
  @file             = file
  @options          = options
  @whiny            = options.has_key?(:whiny) ? options[:whiny] : true
  current_extension = File.extname(file.path)
  @basename         = File.basename(file.path, current_extension)
  @dst              = Paperclip::TempfileFactory.new.generate("#{@basename}.png")
  @dst_path         = File.expand_path(@dst.path)
  @src_path         = File.expand_path(@file.path)
  @first_processor  = first_processor
end

Class Method Details

.make(file, first_processor, options = {}) ⇒ Object



16
17
18
# File 'lib/paperclip-compression/base.rb', line 16

def self.make(file, first_processor, options = {})
  new(file, first_processor, options).make
end