Class: Minitest::Subjective::FileResult::Range
- Inherits:
-
Struct
- Object
- Struct
- Minitest::Subjective::FileResult::Range
- Defined in:
- lib/minitest/subjective/file_result/range.rb
Instance Attribute Summary collapse
-
#end ⇒ Object
Returns the value of attribute end.
-
#start ⇒ Object
Returns the value of attribute start.
Class Method Summary collapse
Instance Method Summary collapse
- #cover?(line_or_range, column_or_start_column = nil, end_column = nil) ⇒ Boolean
- #ends_at?(line, column = nil) ⇒ Boolean
- #starts_at?(line, column = nil) ⇒ Boolean
- #to_s ⇒ Object
Instance Attribute Details
#end ⇒ Object
Returns the value of attribute end
8 9 10 |
# File 'lib/minitest/subjective/file_result/range.rb', line 8 def end @end end |
#start ⇒ Object
Returns the value of attribute start
8 9 10 |
# File 'lib/minitest/subjective/file_result/range.rb', line 8 def start @start end |
Class Method Details
.from_array(args) ⇒ Object
9 10 11 |
# File 'lib/minitest/subjective/file_result/range.rb', line 9 def self.from_array(args) new(start: Location.from_array(args[0..1]), end: Location.from_array(args[2..3])) end |
Instance Method Details
#cover?(line_or_range, column_or_start_column = nil, end_column = nil) ⇒ Boolean
21 22 23 24 |
# File 'lib/minitest/subjective/file_result/range.rb', line 21 def cover?(line_or_range, column_or_start_column = nil, end_column = nil) (covers_line?(line_or_range) && !column_or_start_column) || covers_column?(line_or_range, column_or_start_column, end_column) end |
#ends_at?(line, column = nil) ⇒ Boolean
17 18 19 |
# File 'lib/minitest/subjective/file_result/range.rb', line 17 def ends_at?(line, column = nil) column ? self.end == Location.new(line, column) : self.end.line == line end |
#starts_at?(line, column = nil) ⇒ Boolean
13 14 15 |
# File 'lib/minitest/subjective/file_result/range.rb', line 13 def starts_at?(line, column = nil) column ? start == Location.new(line, column) : start.line == line end |
#to_s ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/minitest/subjective/file_result/range.rb', line 26 def to_s if single_line? [start.line, [start.column, self.end.column].join('-')].join(':') else [start.to_s, self.end.to_s].join('-') end end |