class FlakeySpecCatcher::ChangeSummary

ChangeSummary class

Takes in a git diff block summary and converts it to an object.

This class converts a block of changes (retrieved through use of git diff) into an object that will allow the created ChangeCapsule objects to more easily find and identify changes.

Attributes

change_type[R]
master_commit_line_number[R]
master_commit_lines_altered[R]
working_commit_line_number[R]
working_commit_lines_altered[R]

Public Class Methods

new(change_summary) click to toggle source
# File lib/flakey_spec_catcher/change_summary.rb, line 16
def initialize(change_summary)
  @master_commit_line_number, @master_commit_lines_altered =
    change_summary.split[0].delete('-').split(',').map(&:to_i)
  @master_commit_lines_altered ||= 0
  @working_commit_line_number, @working_commit_lines_altered =
    change_summary.split[1].delete('+').split(',').map(&:to_i)
  @working_commit_lines_altered ||= 0
  initialize_change_type
end

Private Instance Methods

initialize_change_type() click to toggle source
# File lib/flakey_spec_catcher/change_summary.rb, line 28
def initialize_change_type
  @change_type = if @working_commit_lines_altered >= @master_commit_lines_altered
    'ADD'
  else
    'REMOVE'
  end
end