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



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

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

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

Raises:

  • (ArgumentError)


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

def self.run(file, recursive = false, options = {})
  options ||= {}
  if file.is_a?(Array)
    return run_list file, options
  elsif file.is_a?(String) && File.exists?(file) && File.readable?(file)
    if File.directory?(file)
      return run_dir(file, recursive, options)
    elsif File.file?(file)
      return self.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



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

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

.run_list(filelist, options = {}) ⇒ Object



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

def self.run_list(filelist , options = {})
  self.instance.run_list filelist, options
end