Class: Gitlab::WordDiff::PositionsCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/word_diff/positions_counter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePositionsCounter

Returns a new instance of PositionsCounter.


7
8
9
10
11
# File 'lib/gitlab/word_diff/positions_counter.rb', line 7

def initialize
  @pos_old = 1
  @pos_new = 1
  @line_obj_index = 0
end

Instance Attribute Details

#line_obj_indexObject (readonly)

Returns the value of attribute line_obj_index.


13
14
15
# File 'lib/gitlab/word_diff/positions_counter.rb', line 13

def line_obj_index
  @line_obj_index
end

#pos_newObject (readonly)

Returns the value of attribute pos_new.


13
14
15
# File 'lib/gitlab/word_diff/positions_counter.rb', line 13

def pos_new
  @pos_new
end

#pos_oldObject (readonly)

Returns the value of attribute pos_old.


13
14
15
# File 'lib/gitlab/word_diff/positions_counter.rb', line 13

def pos_old
  @pos_old
end

Instance Method Details

#increase_obj_indexObject


20
21
22
# File 'lib/gitlab/word_diff/positions_counter.rb', line 20

def increase_obj_index
  @line_obj_index += 1
end

#increase_pos_numObject


15
16
17
18
# File 'lib/gitlab/word_diff/positions_counter.rb', line 15

def increase_pos_num
  @pos_old += 1
  @pos_new += 1
end

#set_pos_num(old:, new:) ⇒ Object


24
25
26
27
# File 'lib/gitlab/word_diff/positions_counter.rb', line 24

def set_pos_num(old:, new:)
  @pos_old = old
  @pos_new = new
end