Module: MediaType
- Extended by:
- MemoWise
- Defined in:
- app/lib/media_type.rb
Constant Summary collapse
- CATEGORIES =
{}
Class Method Summary collapse
- .archive_extensions ⇒ Object
- .archive_types ⇒ Object
- .categorize(symbol, category) ⇒ Object
- .document_extensions ⇒ Object
- .document_types ⇒ Object
- .image_extensions ⇒ Object
- .image_types ⇒ Object
- .indexable_extensions ⇒ Object
- .indexable_types ⇒ Object
- .model_extensions ⇒ Object
- .model_types ⇒ Object
- .register(type, symbol, category:, additional_types: [], additional_extensions: []) ⇒ Object
- .slicer_extensions ⇒ Object
- .slicer_types ⇒ Object
- .video_extensions ⇒ Object
- .video_types ⇒ Object
Class Method Details
.archive_extensions ⇒ Object
45 46 47 |
# File 'app/lib/media_type.rb', line 45 def archive_extensions category_extensions :archive end |
.archive_types ⇒ Object
41 42 43 |
# File 'app/lib/media_type.rb', line 41 def archive_types category_types :archive end |
.categorize(symbol, category) ⇒ Object
12 13 14 15 |
# File 'app/lib/media_type.rb', line 12 def categorize(symbol, category) CATEGORIES[category] ||= [] CATEGORIES[category] << symbol end |
.document_extensions ⇒ Object
37 38 39 |
# File 'app/lib/media_type.rb', line 37 def document_extensions category_extensions :document end |
.document_types ⇒ Object
33 34 35 |
# File 'app/lib/media_type.rb', line 33 def document_types category_types :document end |
.image_extensions ⇒ Object
21 22 23 |
# File 'app/lib/media_type.rb', line 21 def image_extensions category_extensions :image end |
.image_types ⇒ Object
17 18 19 |
# File 'app/lib/media_type.rb', line 17 def image_types category_types :image end |
.indexable_extensions ⇒ Object
70 71 72 |
# File 'app/lib/media_type.rb', line 70 def indexable_extensions image_extensions + model_extensions + video_extensions + document_extensions + archive_extensions + slicer_extensions end |
.indexable_types ⇒ Object
65 66 67 |
# File 'app/lib/media_type.rb', line 65 def indexable_types image_types + model_types + video_types + document_types + archive_types + slicer_types end |
.model_extensions ⇒ Object
53 54 55 |
# File 'app/lib/media_type.rb', line 53 def model_extensions category_extensions :model end |
.model_types ⇒ Object
49 50 51 |
# File 'app/lib/media_type.rb', line 49 def model_types category_types :model end |
.register(type, symbol, category:, additional_types: [], additional_extensions: []) ⇒ Object
7 8 9 10 |
# File 'app/lib/media_type.rb', line 7 def register(type, symbol, category:, additional_types: [], additional_extensions: []) Mime::Type.register type, symbol, additional_types, additional_extensions categorize(symbol, category) end |
.slicer_extensions ⇒ Object
61 62 63 |
# File 'app/lib/media_type.rb', line 61 def slicer_extensions category_extensions :slicer end |
.slicer_types ⇒ Object
57 58 59 |
# File 'app/lib/media_type.rb', line 57 def slicer_types category_types :slicer end |
.video_extensions ⇒ Object
29 30 31 |
# File 'app/lib/media_type.rb', line 29 def video_extensions category_extensions :video end |
.video_types ⇒ Object
25 26 27 |
# File 'app/lib/media_type.rb', line 25 def video_types category_types :video end |