lib/avm/files/formatter.rb in avm-files-0.4.1 vs lib/avm/files/formatter.rb in avm-files-0.5.0

- old
+ new

@@ -1,7 +1,8 @@ # frozen_string_literal: true +require 'avm/registry' require 'eac_ruby_utils/core_ext' require 'eac_fs/traversable' module Avm module Files @@ -14,12 +15,10 @@ lists.add_symbol :option, :apply, :recursive, :verbose common_constructor :source_paths, :options, default: [{}] do options.assert_valid_keys(self.class.lists.option.values) end - FORMATS = %w[ruby php html python xml javascript json generic_plain].freeze - def run clear search_files apply show_results @@ -57,12 +56,14 @@ end nil end def formats_uncached - FORMATS.map do |identifier| - "avm/files/formatter/formats/#{identifier}".camelize.constantize.new - end + formats_from_registry + end + + def formats_from_registry + ::Avm::Registry.file_formats.available.reverse.map(&:new) end def search_files infov 'Directories to search', source_paths.count source_paths.each do |source_path|