Added example.

This commit is contained in:
agolybev
2015-04-29 19:10:50 +03:00
parent 9fa5abd662
commit 5a5952e41f
288 changed files with 66614 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
class FileUtility
@@exts_document = %w(.docx .doc .odt .rtf .txt .html .htm .mht .pdf .djvu .fb2 .epub .xps)
@@exts_spreadsheet = %w(.xls .xlsx .ods .csv)
@@exts_presentation = %w(.ppt .pptx .odp)
class << self
def get_file_type(file_name)
ext = File.extname(file_name)
if @@exts_document.include? ext
return 'text'
end
if @@exts_spreadsheet.include? ext
return 'spreadsheet'
end
if @@exts_presentation.include? ext
return 'presentation'
end
'text'
end
end
end