Commit deaef747 by Zach Millman Committed by Jon Yurek

Remove unnecessary memoization from content type detector

parent 2fe66872
......@@ -57,20 +57,19 @@ module Paperclip
end
def possible_types
@possible_types ||= MIME::Types.type_for(@filename).collect(&:content_type)
MIME::Types.type_for(@filename).collect(&:content_type)
end
def official_types
@offical_types ||= possible_types.reject{|content_type| content_type.match(/\/x-/) }
possible_types.reject{|content_type| content_type.match(/\/x-/) }
end
def types_matching_file
@types_matching_file ||= possible_types.select{|content_type| content_type == type_from_file_command}
possible_types.select{|content_type| content_type == type_from_file_command}
end
def type_from_file_command
@type_from_file_command ||= FileCommandContentTypeDetector.new(@filename).detect
FileCommandContentTypeDetector.new(@filename).detect
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment