lib/libis/format/cli/convert.rb in libis-format-1.3.4 vs lib/libis/format/cli/convert.rb in libis-format-2.0.0
- old
+ new
@@ -65,11 +65,11 @@
Optionally an options file name can be added to the command line. The options file should be a valid YAML
file that contains either a Hash or an Array of Hashes. The content should contain the required methods and
arguments that any of the targetted converters support.
The source file's format will be identified by the Libis::Format::Identifier and the target file's format
- will be derived from the file's extension. The Libis::Format::TypeDatabase is used to relate extensions
+ will be derived from the file's extension. The Libis::Format::Library is used to relate extensions
with formats.
DESC
method_option :options, aliases: '-o', desc: 'Options file'
@@ -87,11 +87,11 @@
'image SOURCE TARGET [options]' will convert a SOURCE image to TARGET image using the ImageConverter.
A source file name and target file name should be supplied. The source file should exist and be readable.
The target file should be writable, but should not exist.
- The target file's format will be derived from the file's extension. The Libis::Format::TypeDatabase is used
+ The target file's format will be derived from the file's extension. The Libis::Format::Library is used
to relate extensions with formats.
DESC
method_option :page, type: :numeric, aliases: '-p', desc: description(:page)
@@ -263,14 +263,14 @@
[File.basename(source_file, '.*'), ".#{extname(target_format)}"]
) {}
end
def extname(format)
- Libis::Format::TypeDatabase.type_extentions(format).first
+ Libis::Format::Library.get_field(format, :extensions)
end
def get_format(file_name)
- Libis::Format::TypeDatabase.ext_types(File.extname(file_name)).first
+ Libis::Format::Library.get_field_by(:extension, File.extname(file_name), :format)
end
def format_identifier(file)
prompt.say "Identifying format of file '#{file}'"
result = Libis::Format::Identifier.get(file) || {}
\ No newline at end of file