Class: Assert::FileLine

Inherits:
Object
  • Object
show all
Defined in:
lib/assert/file_line.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, line) ⇒ FileLine

Returns a new instance of FileLine.



11
12
13
# File 'lib/assert/file_line.rb', line 11

def initialize(file, line)
  @file, @line = file.to_s, line.to_s
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



9
10
11
# File 'lib/assert/file_line.rb', line 9

def file
  @file
end

#lineObject (readonly)

Returns the value of attribute line.



9
10
11
# File 'lib/assert/file_line.rb', line 9

def line
  @line
end

Class Method Details

.parse(file_line_path) ⇒ Object



5
6
7
# File 'lib/assert/file_line.rb', line 5

def self.parse(file_line_path)
  self.new(*file_line_path.match(/(.+)\:(.+)/)[1..2])
end

Instance Method Details

#==(other_file_line) ⇒ Object



19
20
21
# File 'lib/assert/file_line.rb', line 19

def ==(other_file_line)
  self.file == other_file_line.file && self.line == other_file_line.line
end

#to_sObject



15
16
17
# File 'lib/assert/file_line.rb', line 15

def to_s
  "#{self.file}:#{self.line}"
end