Class: GitDiff::LineNumber

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

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

for_addition, for_context, for_deletion

Constructor Details

#initialize(left, right) ⇒ LineNumber

Returns a new instance of LineNumber.



22
23
24
25
# File 'lib/git_diff/line_number.rb', line 22

def initialize(left, right)
  @left = left
  @right = right
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



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

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right.



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

def right
  @right
end

Instance Method Details

#incrementObject



35
36
37
38
# File 'lib/git_diff/line_number.rb', line 35

def increment
  increment_left
  increment_right
end

#increment_leftObject



27
28
29
# File 'lib/git_diff/line_number.rb', line 27

def increment_left
  @left += 1
end

#increment_rightObject



31
32
33
# File 'lib/git_diff/line_number.rb', line 31

def increment_right
  @right += 1
end

#pairObject



40
41
42
# File 'lib/git_diff/line_number.rb', line 40

def pair
  [left, right]
end