Class: ConvertApi::FormatDetector
- Inherits:
-
Object
- Object
- ConvertApi::FormatDetector
- Defined in:
- lib/convert_api/format_detector.rb
Instance Method Summary collapse
-
#initialize(resource) ⇒ FormatDetector
constructor
A new instance of FormatDetector.
- #run ⇒ Object
Constructor Details
#initialize(resource) ⇒ FormatDetector
Returns a new instance of FormatDetector.
3 4 5 |
# File 'lib/convert_api/format_detector.rb', line 3 def initialize(resource) @resource = resource end |
Instance Method Details
#run ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/convert_api/format_detector.rb', line 7 def run extension = File.extname(path).downcase format = extension[1..-1] raise(FormatError, 'Unable to detect format') if format.nil? format end |