Class: Gitlab::WordDiff::PositionsCounter
- Inherits:
-
Object
- Object
- Gitlab::WordDiff::PositionsCounter
- Defined in:
- lib/gitlab/word_diff/positions_counter.rb
Instance Attribute Summary collapse
-
#line_obj_index ⇒ Object
readonly
Returns the value of attribute line_obj_index.
-
#pos_new ⇒ Object
readonly
Returns the value of attribute pos_new.
-
#pos_old ⇒ Object
readonly
Returns the value of attribute pos_old.
Instance Method Summary collapse
- #increase_obj_index ⇒ Object
- #increase_pos_num ⇒ Object
-
#initialize ⇒ PositionsCounter
constructor
A new instance of PositionsCounter.
- #set_pos_num(old:, new:) ⇒ Object
Constructor Details
#initialize ⇒ PositionsCounter
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_index ⇒ Object (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_new ⇒ Object (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_old ⇒ Object (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_index ⇒ Object
20 21 22 |
# File 'lib/gitlab/word_diff/positions_counter.rb', line 20 def increase_obj_index @line_obj_index += 1 end |
#increase_pos_num ⇒ Object
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 |