Class: Grit::DiffHeader
- Inherits:
-
Object
- Object
- Grit::DiffHeader
- Defined in:
- lib/grit/ext/diff_header.rb
Instance Attribute Summary collapse
-
#added_count ⇒ Object
(also: #count)
readonly
Returns the value of attribute added_count.
-
#added_start ⇒ Object
(also: #start)
readonly
Returns the value of attribute added_start.
-
#removed_count ⇒ Object
readonly
Returns the value of attribute removed_count.
-
#removed_start ⇒ Object
readonly
Returns the value of attribute removed_start.
Instance Method Summary collapse
-
#initialize(hunk_header) ⇒ DiffHeader
constructor
A new instance of DiffHeader.
Constructor Details
#initialize(hunk_header) ⇒ DiffHeader
Returns a new instance of DiffHeader.
9 10 11 12 13 14 15 16 17 |
# File 'lib/grit/ext/diff_header.rb', line 9 def initialize(hunk_header) groups = hunk_header.split('-')[1].split('+') removed = groups.first.strip added = groups.last.sub(' @@', '').strip @removed_start, @removed_count = get_numbers(removed) @added_start, @added_count = get_numbers(added) end |
Instance Attribute Details
#added_count ⇒ Object (readonly) Also known as: count
Returns the value of attribute added_count.
3 4 5 |
# File 'lib/grit/ext/diff_header.rb', line 3 def added_count @added_count end |
#added_start ⇒ Object (readonly) Also known as: start
Returns the value of attribute added_start.
3 4 5 |
# File 'lib/grit/ext/diff_header.rb', line 3 def added_start @added_start end |
#removed_count ⇒ Object (readonly)
Returns the value of attribute removed_count.
3 4 5 |
# File 'lib/grit/ext/diff_header.rb', line 3 def removed_count @removed_count end |
#removed_start ⇒ Object (readonly)
Returns the value of attribute removed_start.
3 4 5 |
# File 'lib/grit/ext/diff_header.rb', line 3 def removed_start @removed_start end |