Sha256: f94f5d80e98a7eb1c25e5039cf426eb18d26a4a3e07aeac6c3d4346ac23a8442

Contents?: true

Size: 548 Bytes

Versions: 6

Compression:

Stored size: 548 Bytes

Contents

module Assert
  class FileLine
    def self.parse(file_line_path)
      self.new(*(file_line_path.to_s.match(/(^[^\:]*)\:*(\d*).*$/) || [])[1..2])
    end

    attr_reader :file, :line

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

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

    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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
assert-2.19.0 lib/assert/file_line.rb
assert-2.18.4 lib/assert/file_line.rb
assert-2.18.3 lib/assert/file_line.rb
assert-2.18.2 lib/assert/file_line.rb
assert-2.18.1 lib/assert/file_line.rb
assert-2.18.0 lib/assert/file_line.rb