Class: Paperclip::MediaTypeSpoofDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/paperclip/media_type_spoof_detector.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, name) ⇒ MediaTypeSpoofDetector

Returns a new instance of MediaTypeSpoofDetector.



7
8
9
10
# File 'lib/paperclip/media_type_spoof_detector.rb', line 7

def initialize(file, name)
  @file = file
  @name = name
end

Class Method Details

.using(file, name) ⇒ Object



3
4
5
# File 'lib/paperclip/media_type_spoof_detector.rb', line 3

def self.using(file, name)
  new(file, name)
end

Instance Method Details

#spoofed?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
# File 'lib/paperclip/media_type_spoof_detector.rb', line 12

def spoofed?
  if ! @name.blank?
    ! supplied_file_media_type.include?(calculated_media_type)
  end
end