Class: Devloop::DiffParser
- Inherits:
-
Object
- Object
- Devloop::DiffParser
- Defined in:
- lib/devloop/diff_parser.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(diff) ⇒ Object
3 4 5 |
# File 'lib/devloop/diff_parser.rb', line 3 def self.call(diff) new.call(diff) end |
Instance Method Details
#call(diff) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/devloop/diff_parser.rb', line 7 def call(diff) lines = diff.split("\n") results = [] lines.each_with_index do |line, index| if line.start_with?("+++ b/") file = line[6..-1] if lines[index + 1] && lines[index + 1].start_with?("@@ -") line_number = lines[index + 1].split(" ")[1].split(",")[0][1..-1] results << "#{file}:#{line_number}" end end end results end |