Class: DiffParser::DiffLine
- Inherits:
-
Object
- Object
- DiffParser::DiffLine
- Defined in:
- lib/diff_parser/diff_line.rb
Constant Summary collapse
- CODE_TYPES =
%w(old new default match)
Instance Attribute Summary collapse
-
#idx ⇒ Object
readonly
Returns the value of attribute idx.
-
#line_new ⇒ Object
readonly
Returns the value of attribute line_new.
-
#line_old ⇒ Object
readonly
Returns the value of attribute line_old.
-
#raw_line ⇒ Object
readonly
Returns the value of attribute raw_line.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(raw_line, type, line_new, line_old, idx, sha) ⇒ DiffLine
constructor
A new instance of DiffLine.
- #line_code ⇒ Object
- #line_of_code? ⇒ Boolean
Constructor Details
#initialize(raw_line, type, line_new, line_old, idx, sha) ⇒ DiffLine
Returns a new instance of DiffLine.
7 8 9 10 11 12 13 14 |
# File 'lib/diff_parser/diff_line.rb', line 7 def initialize(raw_line, type, line_new, line_old, idx, sha) @raw_line = raw_line @line_new = line_new @line_old = line_old @idx = idx @sha = sha @type = type end |
Instance Attribute Details
#idx ⇒ Object (readonly)
Returns the value of attribute idx.
5 6 7 |
# File 'lib/diff_parser/diff_line.rb', line 5 def idx @idx end |
#line_new ⇒ Object (readonly)
Returns the value of attribute line_new.
5 6 7 |
# File 'lib/diff_parser/diff_line.rb', line 5 def line_new @line_new end |
#line_old ⇒ Object (readonly)
Returns the value of attribute line_old.
5 6 7 |
# File 'lib/diff_parser/diff_line.rb', line 5 def line_old @line_old end |
#raw_line ⇒ Object (readonly)
Returns the value of attribute raw_line.
5 6 7 |
# File 'lib/diff_parser/diff_line.rb', line 5 def raw_line @raw_line end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/diff_parser/diff_line.rb', line 5 def type @type end |
Instance Method Details
#line_code ⇒ Object
20 21 22 |
# File 'lib/diff_parser/diff_line.rb', line 20 def line_code "#{sha}_#{line_old}_#{line_new}_#{type}_#{idx}" end |
#line_of_code? ⇒ Boolean
16 17 18 |
# File 'lib/diff_parser/diff_line.rb', line 16 def line_of_code? CODE_TYPES.include?(type) end |