class Yalphabetize::Yalphabetizer
Attributes
Public Class Methods
Source
# File lib/yalphabetize/yalphabetizer.rb, line 5 def self.call(args = [], options = {}) new(args, options).call end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 9 def initialize(args, options) @args = args @options = options end
Public Instance Methods
Source
# File lib/yalphabetize/yalphabetizer.rb, line 14 def call initial_log process_files final_log end
Private Instance Methods
Source
# File lib/yalphabetize/yalphabetizer.rb, line 70 def alphabetizer_class Yalphabetize::Alphabetizer end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 45 def file_paths @_file_paths ||= finder.paths(only: only_paths, exclude: Yalphabetize.config['exclude']) end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 86 def file_yalphabetizer_class Yalphabetize::FileYalphabetizer end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 57 def final_log logger.final_summary logger.uncorrected_offences? ? 1 : 0 end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 66 def finder Yalphabetize::YamlFinder end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 24 def initial_log logger.initial_summary(file_paths) end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 82 def logger @_logger ||= Yalphabetize::Logger.new end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 78 def offence_detector_class Yalphabetize::OffenceDetector end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 49 def only_paths if args.any? args else Yalphabetize.config['only'] end end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 90 def order_checker_class OrderCheckers::TOKEN_MAPPING[Yalphabetize.config['sort_by']] end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 32 def process_file(file_path) file_yalphabetizer_class.new( file_path, reader_class: reader_class, offence_detector_class: offence_detector_class, logger: logger, autocorrect: options[:autocorrect], alphabetizer_class: alphabetizer_class, writer_class: writer_class, order_checker_class: order_checker_class ).call end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 28 def process_files file_paths.each { |file_path| process_file(file_path) } end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 62 def reader_class Yalphabetize::Reader end
Source
# File lib/yalphabetize/yalphabetizer.rb, line 74 def writer_class Yalphabetize::Writer end