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.



119
120
121
122
123
124
125
# File 'lib/shrine/plugins/instrumentation.rb', line 119

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

#exists?Boolean

Sends a ‘exists.shrine` event.

Returns:

  • (Boolean)


110
111
112
113
114
115
116
# File 'lib/shrine/plugins/instrumentation.rb', line 110

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

#stream(destination, **options) ⇒ Object

Sends a ‘download.shrine` event.



98
99
100
101
102
103
104
105
106
107
# File 'lib/shrine/plugins/instrumentation.rb', line 98

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