Class: Hydra::FileCharacterization::Characterizer
- Inherits:
-
Object
- Object
- Hydra::FileCharacterization::Characterizer
- Includes:
- Open3
- Defined in:
- lib/hydra/file_characterization/characterizer.rb
Direct Known Subclasses
Hydra::FileCharacterization::Characterizers::Ffprobe, Hydra::FileCharacterization::Characterizers::Fits
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(filename, tool_path = nil) ⇒ Characterizer
constructor
A new instance of Characterizer.
- #tool_path ⇒ Object
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
#filename ⇒ Object (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
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# 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 if tool_path.respond_to?(:call) tool_path.call(filename) else internal_call end end |
#tool_path ⇒ Object
29 30 31 |
# File 'lib/hydra/file_characterization/characterizer.rb', line 29 def tool_path @tool_path || self.class.tool_path || (raise Hydra::FileCharacterization::UnspecifiedToolPathError.new(self.class)) end |