Class: MetricAdapter::Location

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(combined_path, line = 0) ⇒ Location

Returns a new instance of Location.



5
6
7
8
# File 'lib/location.rb', line 5

def initialize(combined_path, line = 0)
  @path, @line = parse_path(combined_path || '')
  @line ||= line
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line.



3
4
5
# File 'lib/location.rb', line 3

def line
  @line
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/location.rb', line 3

def path
  @path
end

Instance Method Details

#<=>(other) ⇒ Object



14
15
16
# File 'lib/location.rb', line 14

def <=>(other)
  [path,line] <=> [other.path, other.line]
end

#to_sObject



10
11
12
# File 'lib/location.rb', line 10

def to_s
  "#{path}:#{line}"
end