Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
deaef747
Commit
deaef747
authored
Mar 08, 2013
by
Zach Millman
Committed by
Jon Yurek
Jul 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary memoization from content type detector
parent
2fe66872
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
lib/paperclip/content_type_detector.rb
+4
-5
No files found.
lib/paperclip/content_type_detector.rb
View file @
deaef747
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment