Module: Shrine::Plugins::TypePredicates::FileMethods
- Defined in:
- lib/shrine/plugins/type_predicates.rb
Instance Method Summary collapse
Instance Method Details
#audio? ⇒ Boolean
33 34 35 |
# File 'lib/shrine/plugins/type_predicates.rb', line 33 def audio? general_type?("audio") end |
#image? ⇒ Boolean
25 26 27 |
# File 'lib/shrine/plugins/type_predicates.rb', line 25 def image? general_type?("image") end |
#text? ⇒ Boolean
37 38 39 |
# File 'lib/shrine/plugins/type_predicates.rb', line 37 def text? general_type?("text") end |
#type?(type) ⇒ Boolean
41 42 43 44 45 46 47 |
# File 'lib/shrine/plugins/type_predicates.rb', line 41 def type?(type) matching_mime_type = shrine_class.type_lookup(type) fail Error, "type #{type.inspect} is not recognized by the MIME library" unless matching_mime_type mime_type! == matching_mime_type end |
#video? ⇒ Boolean
29 30 31 |
# File 'lib/shrine/plugins/type_predicates.rb', line 29 def video? general_type?("video") end |