class FormatParser::ActiveStorage::BlobAnalyzer
Public Class Methods
accept?(_blob)
click to toggle source
Format parser is able to handle a lot of format so by default it will accept all files
@return [Boolean, true] always return true
# File lib/active_storage/blob_analyzer.rb, line 13 def self.accept?(_blob) true end
new(blob)
click to toggle source
# File lib/active_storage/blob_analyzer.rb, line 17 def initialize(blob) @blob = blob end
Public Instance Methods
metadata()
click to toggle source
@return [Hash] file metadatas
# File lib/active_storage/blob_analyzer.rb, line 22 def metadata io = BlobIO.new(@blob) parsed_file = FormatParser.parse(io) if parsed_file # We symbolize keys because of existing output hash format of ImageAnalyzer parsed_file.as_json.symbolize_keys else logger.info "Skipping file analysis because FormatParser doesn't support the file" end end