module Shrine::Plugins::Instrumentation::FileMethods

Public Instance Methods

delete() click to toggle source

Sends a ‘delete.shrine` event.

Calls superclass method
# File lib/shrine/plugins/instrumentation.rb, line 119
def delete
  shrine_class.instrument(:delete, {
    storage: storage_key,
    location: id,
  }) { super }
end
exists?() click to toggle source

Sends a ‘exists.shrine` event.

Calls superclass method
# File lib/shrine/plugins/instrumentation.rb, line 111
def exists?
  shrine_class.instrument(:exists, {
    storage: storage_key,
    location: id,
  }) { super }
end
stream(destination, **options) click to toggle source

Sends a ‘download.shrine` event.

Calls superclass method
# File lib/shrine/plugins/instrumentation.rb, line 100
def stream(destination, **options)
  return super if opened?

  shrine_class.instrument(:download, {
    storage: storage_key,
    location: id,
    download_options: options,
  }) { super(destination, **options, instrument: false) }
end

Private Instance Methods

_open(instrument: true, **options) click to toggle source

Sends an ‘open.shrine` event.

Calls superclass method
# File lib/shrine/plugins/instrumentation.rb, line 129
def _open(instrument: true, **options)
  return super(**options) unless instrument

  shrine_class.instrument(:open, {
    storage: storage_key,
    location: id,
    download_options: options,
  }) { super(**options) }
end