Module: Shrine::Plugins::TypePredicates
- Defined in:
- lib/shrine/plugins/type_predicates.rb
Overview
Documentation can be found on shrinerb.com/docs/plugins/type_predicates
Defined Under Namespace
Modules: ClassMethods, FileMethods Classes: MimeDatabase
Class Method Summary collapse
Class Method Details
.configure(uploader, methods: [], **opts) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/shrine/plugins/type_predicates.rb', line 7 def self.configure(uploader, methods: [], **opts) uploader.opts[:type_predicates] ||= { mime: :mini_mime } uploader.opts[:type_predicates].merge!(opts) methods.each do |name| uploader::UploadedFile.send(:define_method, "#{name}?") { type?(name) } end end |