Class: Assert::FileLine
- Inherits:
-
Object
- Object
- Assert::FileLine
- Defined in:
- lib/assert/file_line.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other_file_line) ⇒ Object
-
#initialize(file = nil, line = nil) ⇒ FileLine
constructor
A new instance of FileLine.
- #to_s ⇒ Object
Constructor Details
#initialize(file = nil, line = nil) ⇒ FileLine
Returns a new instance of FileLine.
9 10 11 |
# File 'lib/assert/file_line.rb', line 9 def initialize(file = nil, line = nil) @file, @line = file.to_s, line.to_s end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/assert/file_line.rb', line 7 def file @file end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
7 8 9 |
# File 'lib/assert/file_line.rb', line 7 def line @line end |
Class Method Details
.parse(file_line_path) ⇒ Object
3 4 5 |
# File 'lib/assert/file_line.rb', line 3 def self.parse(file_line_path) self.new(*(file_line_path.to_s.match(/(^[^\:]*)\:*(\d*).*$/) || [])[1..2]) end |
Instance Method Details
#==(other_file_line) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/assert/file_line.rb', line 17 def ==(other_file_line) if other_file_line.kind_of?(FileLine) self.file == other_file_line.file && self.line == other_file_line.line else super end end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/assert/file_line.rb', line 13 def to_s "#{self.file}:#{self.line}" end |