class Paperclip::ContentTypeDetector

Constants

EMPTY_TYPE
SENSIBLE_DEFAULT

Public Class Methods

new(filename) click to toggle source
# File lib/paperclip/content_type_detector.rb, line 6
def initialize(filename)
  @filename = filename
end

Public Instance Methods

detect() click to toggle source
# File lib/paperclip/content_type_detector.rb, line 10
def detect
  if blank?
    SENSIBLE_DEFAULT
  elsif empty?
    EMPTY_TYPE
  elsif !match?
    type_from_file_command
  elsif !multiple?
    possible_types.first
  else
    best_type_match
  end.to_s
end