Class: GitDiff::LineNumberCalculation
- Inherits:
-
Object
- Object
- GitDiff::LineNumberCalculation
- Defined in:
- lib/git_diff/line_number_calculation.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
Instance Method Summary collapse
- #increment(line) ⇒ Object
-
#initialize(line_number) ⇒ LineNumberCalculation
constructor
A new instance of LineNumberCalculation.
Constructor Details
#initialize(line_number) ⇒ LineNumberCalculation
Returns a new instance of LineNumberCalculation.
7 8 9 |
# File 'lib/git_diff/line_number_calculation.rb', line 7 def initialize(line_number) @current = line_number end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
5 6 7 |
# File 'lib/git_diff/line_number_calculation.rb', line 5 def current @current end |
Instance Method Details
#increment(line) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/git_diff/line_number_calculation.rb', line 11 def increment(line) line.line_number = current if line.addition? current.increment_right elsif line.deletion? current.increment_left else current.increment end end |