Sha256: 7db515adff09714279628ab862137f944e6781e1ee18bad6530fcd96a8dd3a82
Contents?: true
Size: 1.56 KB
Versions: 6
Compression:
Stored size: 1.56 KB
Contents
module PaperclipCompression class Base def initialize(file, 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) end def self.make(file, options = {}) new(file, options).make end protected def init_cli_opts(type, default_opts) # use default options in the papeclip config if exists, otherwise use gem defaults. default_opts = init_default_opts(Paperclip::Attachment.default_options, type, default_opts) # use processor_options if exists, otherwise use defaults. init_default_opts(@options[:processor_options], type, default_opts) end def command_path(command) folder = if OS.osx? 'osx' elsif OS.linux? || RUBY_PLATFORM =~ /freebsd/ File.join('linux', OS.bits.eql?(64) ? 'x64' : 'x86') elsif OS.windows? OS.bits.eql?(64) ? 'win64' : 'win32' end File.join(PaperclipCompression.root, 'bin', folder, command) end private def init_default_opts(opts, type, default_opts) if opts && (compression_opts = opts[:compression]) if compression_opts.has_key?(type) if (type_opts = compression_opts[type]) type_opts.kind_of?(String) ? type_opts : default_opts else false end else default_opts end else default_opts end end end end
Version data entries
6 entries across 6 versions & 1 rubygems