-
-
Save lloricode/6a8b4129f2444e1ccceda1915f26703c to your computer and use it in GitHub Desktop.
All major document mime types (Microsoft Office, Apple iWork, Adobe PDF) as a Ruby Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DocumentFileTypes | |
module Microsoft | |
WORD = %w( | |
application/msword | |
application/vnd.openxmlformats-officedocument.wordprocessingml.document | |
application/vnd.openxmlformats-officedocument.wordprocessingml.template | |
application/vnd.ms-word.document.macroEnabled.12 | |
application/vnd.ms-word.template.macroEnabled.12 | |
) | |
EXCEL = %w( | |
application/vnd.ms-excel | |
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | |
application/vnd.openxmlformats-officedocument.spreadsheetml.template | |
application/vnd.ms-excel.sheet.macroEnabled.12 | |
application/vnd.ms-excel.template.macroEnabled.12 | |
application/vnd.ms-excel.addin.macroEnabled.12 | |
application/vnd.ms-excel.sheet.binary.macroEnabled.12 | |
) | |
POWER_POINT = %w( | |
application/vnd.ms-powerpoint | |
application/vnd.openxmlformats-officedocument.presentationml.presentation | |
application/vnd.openxmlformats-officedocument.presentationml.template | |
application/vnd.openxmlformats-officedocument.presentationml.slideshow | |
application/vnd.ms-powerpoint.addin.macroEnabled.12 | |
application/vnd.ms-powerpoint.presentation.macroEnabled.12 | |
application/vnd.ms-powerpoint.template.macroEnabled.12 | |
application/vnd.ms-powerpoint.slideshow.macroEnabled.12 | |
) | |
end | |
module Apple | |
IWORK = ['application/x-iwork-pages-sffpages'] | |
end | |
module Adobe | |
PDF = ["application/pdf"] | |
end | |
TEXT_DOC_MIME_TYPES = Microsoft::WORD + ['text/plain'] | |
SPREADSHEET_MIME_TYPES = Microsoft::EXCEL + ['text/csv'] | |
PRESENTATION_MIME_TYPES = Microsoft::POWER_POINT | |
ALL = TEXT_DOC_MIME_TYPES + SPREADSHEET_MIME_TYPES + PRESENTATION_MIME_TYPES + Apple::IWORK + Adobe::PDF | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment