Class: Libis::Format::Tool::IdentificationTool

Inherits:
Object
  • Object
show all
Includes:
Tools::Logger, Singleton
Defined in:
lib/libis/format/tool/identification_tool.rb

Direct Known Subclasses

Droid, ExtensionIdentification, Fido, FileTool

Class Method Summary collapse

Class Method Details

.bad_mimetype(mimetype) ⇒ Object



21
22
23
# File 'lib/libis/format/tool/identification_tool.rb', line 21

def self.bad_mimetype(mimetype)
  instance.bad_mimetype(mimetype)
end

.run(file, recursive = false, **options) ⇒ Object

Raises:

  • (ArgumentError)


25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/libis/format/tool/identification_tool.rb', line 25

def self.run(file, recursive = false, **options)
  if file.is_a?(Array)
    return run_list file, **options
  elsif file.is_a?(String) && File.exist?(file) && File.readable?(file)
    if File.directory?(file)
      return run_dir(file, recursive, **options)
    elsif File.file?(file)
      return instance.run(file, **options)
    end
  end

  raise ArgumentError,
        'IdentificationTool: file argument should be a path to an existing file or directory or a list of those'
end

.run_dir(file, recursive = true, **options) ⇒ Object



40
41
42
# File 'lib/libis/format/tool/identification_tool.rb', line 40

def self.run_dir(file, recursive = true, **options)
  instance.run_dir file, recursive, **options
end

.run_list(filelist, **options) ⇒ Object



44
45
46
# File 'lib/libis/format/tool/identification_tool.rb', line 44

def self.run_list(filelist, **options)
  instance.run_list filelist, **options
end