module Shrine::Plugins::TypePredicates

Documentation can be found on shrinerb.com/docs/plugins/type_predicates

Public Class Methods

configure(uploader, methods: [], **opts) click to toggle source
# 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