Class: Hydra::FileCharacterization::Characterizer

Inherits:
Object
  • Object
show all
Includes:
Open3
Defined in:
lib/hydra/file_characterization/characterizer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, tool_path = nil) ⇒ Characterizer

Returns a new instance of Characterizer.



13
14
15
16
# File 'lib/hydra/file_characterization/characterizer.rb', line 13

def initialize(filename, tool_path = nil)
  @filename = filename
  @tool_path = tool_path
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



12
13
14
# File 'lib/hydra/file_characterization/characterizer.rb', line 12

def filename
  @filename
end

Instance Method Details

#callObject



18
19
20
21
22
# File 'lib/hydra/file_characterization/characterizer.rb', line 18

def call
  raise Hydra::FileCharacterization::FileNotFoundError, "File: #{filename} does not exist." unless File.exist?(filename)

  post_process(output)
end

#loggerObject



28
29
30
# File 'lib/hydra/file_characterization/characterizer.rb', line 28

def logger
  @logger ||= activefedora_logger || Logger.new(STDERR)
end

#tool_pathObject



24
25
26
# File 'lib/hydra/file_characterization/characterizer.rb', line 24

def tool_path
  @tool_path || self.class.tool_path || convention_based_tool_name
end