module Shrine::Plugins::Moving

  1. lib/shrine/plugins/moving.rb

The moving plugin will move files to storages instead of copying them, when the storage supports it. For FileSystem this will issue a mv command, which is instantaneous regardless of the filesize, so in that case loading this plugin can significantly speed up the attachment process.

plugin :moving

By default files will be moved whenever the storage supports it. If you want moving to happen only for certain storages, you can set :storages:

plugin :moving, storages: [:cache]

Methods

Public Class

  1. configure

Public Class methods

configure (uploader, opts = {})
[show source]
# File lib/shrine/plugins/moving.rb, line 16
def self.configure(uploader, opts = {})
  uploader.opts[:moving_storages] = opts.fetch(:storages, uploader.opts[:moving_storages])
end