Module: GitDiff::RangeInfo::ClassMethods

Included in:
GitDiff::RangeInfo
Defined in:
lib/git_diff/range_info.rb

Instance Method Summary collapse

Instance Method Details

#extract_hunk_range_data(string) ⇒ Object



14
15
16
# File 'lib/git_diff/range_info.rb', line 14

def extract_hunk_range_data(string)
  /@@ \-(.+) \+(.+) @@(.*)/.match(string)
end

#from_string(string) ⇒ Object



8
9
10
11
12
# File 'lib/git_diff/range_info.rb', line 8

def from_string(string)
  if (range_data = extract_hunk_range_data(string))
    new(*range_data.captures)
  end
end