Class: GitDiff::LineNumberRange
- Inherits:
-
Object
- Object
- GitDiff::LineNumberRange
- Defined in:
- lib/git_diff/line_number_range.rb
Instance Attribute Summary collapse
-
#number_of_lines ⇒ Object
readonly
Returns the value of attribute number_of_lines.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(start = 0, number_of_lines = 1) ⇒ LineNumberRange
constructor
A new instance of LineNumberRange.
- #to_s(type) ⇒ Object
Constructor Details
#initialize(start = 0, number_of_lines = 1) ⇒ LineNumberRange
Returns a new instance of LineNumberRange.
11 12 13 14 |
# File 'lib/git_diff/line_number_range.rb', line 11 def initialize(start = 0, number_of_lines = 1) @start = start.to_i @number_of_lines = number_of_lines.to_i end |
Instance Attribute Details
#number_of_lines ⇒ Object (readonly)
Returns the value of attribute number_of_lines.
5 6 7 |
# File 'lib/git_diff/line_number_range.rb', line 5 def number_of_lines @number_of_lines end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
5 6 7 |
# File 'lib/git_diff/line_number_range.rb', line 5 def start @start end |
Class Method Details
.from_string(string) ⇒ Object
7 8 9 |
# File 'lib/git_diff/line_number_range.rb', line 7 def self.from_string(string) new(*string.split(",")) end |
Instance Method Details
#to_s(type) ⇒ Object
16 17 18 |
# File 'lib/git_diff/line_number_range.rb', line 16 def to_s(type) "#{type}#{start},#{number_of_lines}" end |