Class: Scold::Hounder
- Inherits:
-
Object
- Object
- Scold::Hounder
- Defined in:
- lib/scold/hounder.rb
Constant Summary collapse
- CHANGED =
%w(M A R C).freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#call ⇒ Object
rubocop:disable Metrics/AbcSize.
-
#initialize(args = []) ⇒ Hounder
constructor
A new instance of Hounder.
Constructor Details
#initialize(args = []) ⇒ Hounder
Returns a new instance of Hounder.
5 6 7 |
# File 'lib/scold/hounder.rb', line 5 def initialize(args = []) @args = args.dup end |
Class Method Details
.run(args = []) ⇒ Object
24 25 26 |
# File 'lib/scold/hounder.rb', line 24 def self.run(args = []) new(args).call end |
Instance Method Details
#call ⇒ Object
rubocop:disable Metrics/AbcSize
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# 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 |