Sha256: 2249a88cf12b9036aed85805710a715e2fd7ebbbc83089eac9c170ffb9ff7095
Contents?: true
Size: 1.11 KB
Versions: 31
Compression:
Stored size: 1.11 KB
Contents
require_relative 'identification_tool' module Libis module Format module Tool class ExtensionIdentification < Libis::Format::Tool::IdentificationTool def run_list(filelist, _options = {}) output = runner(nil, filelist) process_output(output) end def run_dir(dir, recursive = true, _options = {}) filelist = find_files(dir, recursive) output = runner(nil, filelist) process_output(output) end def run(file, _options) output = runner(file) process_output(output) end protected def runner(*args) args.map do |file| info = ::Libis::Format::TypeDatabase.ext_infos(File.extname(file)).first if info { filepath: file, mimetype: (info[:MIME].first rescue nil), puid: (info[:PUID].first rescue nil), matchtype: 'extension', tool: :type_database } end end.cleanup end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems