Class: GitDiff::RangeInfo

Inherits:
Object
  • Object
show all
Extended by:
ClassMethods
Defined in:
lib/git_diff/range_info.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

extract_hunk_range_data, from_string

Constructor Details

#initialize(original_range, new_range, header) ⇒ RangeInfo

Returns a new instance of RangeInfo.



20
21
22
23
24
# File 'lib/git_diff/range_info.rb', line 20

def initialize(original_range, new_range, header)
  @original_range = LineNumberRange.from_string(original_range)
  @new_range = LineNumberRange.from_string(new_range)
  @header = header.strip
end

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



5
6
7
# File 'lib/git_diff/range_info.rb', line 5

def header
  @header
end

#new_rangeObject (readonly)

Returns the value of attribute new_range.



5
6
7
# File 'lib/git_diff/range_info.rb', line 5

def new_range
  @new_range
end

#original_rangeObject (readonly)

Returns the value of attribute original_range.



5
6
7
# File 'lib/git_diff/range_info.rb', line 5

def original_range
  @original_range
end

Instance Method Details

#to_sObject



26
27
28
# File 'lib/git_diff/range_info.rb', line 26

def to_s
  "@@ #{original_range.to_s(:-)} #{new_range.to_s(:+)} @@ #{header}".strip
end