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.



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

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

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



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

def filename
  @filename
end

Instance Method Details

#callObject



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

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

  post_process(output)
end

#tool_pathObject



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

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