Class: GitDiffParser::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/git_diff_parser/line.rb

Overview

Parsed line

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Line

Returns a new instance of Line.

Parameters:

  • params (Hash)

    required params

Options Hash (params):

  • :number (Integer)

    line number (required)

  • :content (String)

    content (required)

  • :patch_position (Integer)

    patch position (required)



16
17
18
19
20
21
22
23
# File 'lib/git_diff_parser/line.rb', line 16

def initialize(params)
  raise(ArgumentError('number is required')) unless params[:number]
  raise(ArgumentError('content is required')) unless params[:content]
  raise(ArgumentError('patch_position is required')) unless params[:patch_position]
  @number = params[:number]
  @content = params[:content]
  @patch_position = params[:patch_position]
end

Instance Attribute Details

#contentString (readonly)

Returns content.

Returns:

  • (String)

    content



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

def content
  @content
end

#numberInteger (readonly)

Returns line number.

Returns:

  • (Integer)

    line number



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

def number
  @number
end

#patch_positionInteger (readonly)

Returns line patch position.

Returns:

  • (Integer)

    line patch position



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

def patch_position
  @patch_position
end

Instance Method Details

#changed?Boolean

Returns true if line changed.

Returns:

  • (Boolean)

    true if line changed



26
27
28
# File 'lib/git_diff_parser/line.rb', line 26

def changed?
  true
end