Module: Speccloak::ChangedLinesExtractor
- Defined in:
- lib/speccloak/changed_lines_extractor.rb
Class Method Summary collapse
Class Method Details
.parse(diff_output, changed_lines) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/speccloak/changed_lines_extractor.rb', line 5 def self.parse(diff_output, changed_lines) diff_output.each_line do |line| next unless line.start_with?("@@") match = line.match(Speccloak::GitCommands::DIFF_HUNK_HEADER_REGEX) next unless match start_line = match[1].to_i line_count = match[2] ? match[2].delete(",").to_i : 1 (start_line...(start_line + line_count)).each { |line_num| changed_lines << line_num } end changed_lines end |