Class: ActiveStorageValidations::Analyzer
- Inherits:
-
Object
- Object
- ActiveStorageValidations::Analyzer
- Includes:
- ASVAttachable, ASVLoggable
- Defined in:
- lib/active_storage_validations/analyzer.rb
Overview
Active Storage Validations Analyzer
This is an abstract base class for analyzers, which extract metadata from attachables. See ActiveStorageValidations::Analyzer::VideoAnalyzer for an example of a concrete subclass.
Heavily (not to say 100%) inspired by Rails own ActiveStorage::Analyzer
Direct Known Subclasses
AudioAnalyzer, ContentTypeAnalyzer, ImageAnalyzer, NullAnalyzer, VideoAnalyzer
Defined Under Namespace
Classes: AudioAnalyzer, ContentTypeAnalyzer, ImageAnalyzer, NullAnalyzer, VideoAnalyzer
Instance Attribute Summary collapse
-
#attachable ⇒ Object
readonly
Returns the value of attribute attachable.
Instance Method Summary collapse
-
#content_type ⇒ Object
Override this method in a concrete subclass.
-
#initialize(attachable) ⇒ Analyzer
constructor
A new instance of Analyzer.
-
#metadata ⇒ Object
Override this method in a concrete subclass.
Methods included from ASVLoggable
Constructor Details
#initialize(attachable) ⇒ Analyzer
Returns a new instance of Analyzer.
19 20 21 |
# File 'lib/active_storage_validations/analyzer.rb', line 19 def initialize(attachable) @attachable = attachable end |
Instance Attribute Details
#attachable ⇒ Object (readonly)
Returns the value of attribute attachable.
17 18 19 |
# File 'lib/active_storage_validations/analyzer.rb', line 17 def attachable @attachable end |
Instance Method Details
#content_type ⇒ Object
Override this method in a concrete subclass. Have it return a String content type.
24 25 26 |
# File 'lib/active_storage_validations/analyzer.rb', line 24 def content_type raise NotImplementedError end |
#metadata ⇒ Object
Override this method in a concrete subclass. Have it return a Hash of metadata.
29 30 31 |
# File 'lib/active_storage_validations/analyzer.rb', line 29 def raise NotImplementedError end |