Module: Shrine::Plugins::Instrumentation::FileMethods

Defined in:
lib/shrine/plugins/instrumentation.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject

Sends a `delete.shrine` event.


115
116
117
118
119
120
# File 'lib/shrine/plugins/instrumentation.rb', line 115

def delete
  shrine_class.instrument(:delete, {
    storage: storage_key,
    location: id,
  }) { super }
end

#exists?Boolean

Sends a `exists.shrine` event.

Returns:

  • (Boolean)

107
108
109
110
111
112
# File 'lib/shrine/plugins/instrumentation.rb', line 107

def exists?
  shrine_class.instrument(:exists, {
    storage: storage_key,
    location: id,
  }) { super }
end

#stream(destination, **options) ⇒ Object

Sends a `download.shrine` event.


96
97
98
99
100
101
102
103
104
# File 'lib/shrine/plugins/instrumentation.rb', line 96

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