class ActiveStorage::Analyzer
ActiveStorage::Analyzer::VideoAnalyzer for an example of a concrete subclass.
This is an abstract base class for analyzers, which extract metadata from blobs. See
def self.accept?(blob)
Implement this method in a concrete subclass. Have it return true when given a blob from which
def self.accept?(blob) false end
def self.analyze_later?
Implement this method in concrete subclasses. It will determine if blob analysis
def self.analyze_later? true end
def download_blob_to_tempfile(&block) # :doc:
Downloads the blob to a tempfile on disk. Yields the tempfile.
def download_blob_to_tempfile(&block) # :doc: blob.open tmpdir: tmpdir, &block end
def initialize(blob)
def initialize(blob) @blob = blob end
def instrument(analyzer, &block) # :doc:
def instrument(analyzer, &block) # :doc: ActiveSupport::Notifications.instrument("analyze.active_storage", analyzer: analyzer, &block) end
def logger # :doc:
def logger # :doc: ActiveStorage.logger end
def metadata
def metadata raise NotImplementedError end
def tmpdir # :doc:
def tmpdir # :doc: Dir.tmpdir end