Sha256: 7469800146670d329d29e0689c9e81c7316f5deefe495eac9d59f1ef6c13f308

Contents?: true

Size: 652 Bytes

Versions: 1

Compression:

Stored size: 652 Bytes

Contents

module FaceControl
  class CheckerRunner
    def initialize(checker_class, filenames = [], options = {})
      @checker = checker_class.new
      if @checker.respond_to?(:options=)
        @checker.options = options
      end

      @filenames = filenames
    end

    def comments
      return [] if relevant_filenames.empty?

      @checker.parse(`#{@checker.command(relevant_filenames.join(' '))}`)
    end

    private

    def relevant_filenames
      @relevant_filenames ||= @checker.relevant_globs.map do |glob|
        @filenames.select do |filename|
          File.fnmatch?(glob, filename)
        end
      end.flatten.uniq
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
face_control-0.7.0 lib/face_control/checker_runner.rb