Class: GitDiff::Hunk
- Inherits:
-
Object
- Object
- GitDiff::Hunk
- 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.
7 8 9 10 |
# File 'lib/git_diff/hunk.rb', line 7 def initialize(range_info) @range_info = range_info @lines = [] end |
Instance Attribute Details
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
5 6 7 |
# File 'lib/git_diff/hunk.rb', line 5 def lines @lines end |
#range_info ⇒ Object (readonly)
Returns the value of attribute range_info.
5 6 7 |
# File 'lib/git_diff/hunk.rb', line 5 def range_info @range_info end |
Instance Method Details
#<<(string) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/git_diff/hunk.rb', line 12 def <<(string) Line.from_string(string).tap do |line| line_number_calculation.increment(line) lines << line end end |
#stats ⇒ Object
19 20 21 |
# File 'lib/git_diff/hunk.rb', line 19 def stats @stats ||= Stats.total(collector) end |