Class: Gitlab::WordDiff::LineProcessor

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

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ LineProcessor

Returns a new instance of LineProcessor.


12
13
14
# File 'lib/gitlab/word_diff/line_processor.rb', line 12

def initialize(line)
  @line = line
end

Instance Method Details

#extractObject


16
17
18
19
20
21
22
# File 'lib/gitlab/word_diff/line_processor.rb', line 16

def extract
  return if empty_line?
  return Segments::DiffHunk.new(full_line) if diff_hunk?
  return Segments::Newline.new if newline_delimiter?

  Segments::Chunk.new(full_line)
end