class Scold::Hounder

Constants

CHANGED

Public Class Methods

new(args = []) click to toggle source
# File lib/scold/hounder.rb, line 5
def initialize(args = [])
  @args = args.dup
end
run(args = []) click to toggle source
# File lib/scold/hounder.rb, line 24
def self.run(args = [])
  new(args).call
end

Public Instance Methods

call() click to toggle source
# File lib/scold/hounder.rb, line 9
def call # rubocop:disable Metrics/AbcSize
  files = `git status --porcelain`.lines.inject([]) do |accum, line|
    if CHANGED.include?(line[0]) || CHANGED.include?(line[1])
      accum << line[3..-1].split("->").last.strip
    end
    accum
  end
  if files.empty?
    require "scold/exit"
    Exit::SUCCESS
  else
    Scolder.run(@args.concat(files))
  end
end