Class: GitDiff::Hunk
- Inherits:
-
Object
- Object
- GitDiff::Hunk
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/git_diff/hunk.rb
Instance Attribute Summary collapse
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#range_info ⇒ Object
readonly
Returns the value of attribute range_info.
Instance Method Summary collapse
- #<<(string) ⇒ Object
-
#initialize(range_info) ⇒ Hunk
constructor
A new instance of Hunk.
- #stats ⇒ Object
Constructor Details
#initialize(range_info) ⇒ Hunk
Returns a new instance of Hunk.
12 13 14 15 |
# File 'lib/git_diff/hunk.rb', line 12 def initialize(range_info) @range_info = range_info @lines = [] end |
Instance Attribute Details
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
10 11 12 |
# File 'lib/git_diff/hunk.rb', line 10 def lines @lines end |
#range_info ⇒ Object (readonly)
Returns the value of attribute range_info.
10 11 12 |
# File 'lib/git_diff/hunk.rb', line 10 def range_info @range_info end |
Instance Method Details
#<<(string) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/git_diff/hunk.rb', line 17 def <<(string) Line.from_string(string).tap do |line| line_number_calculation.increment(line) lines << line end end |