Class: Watchr::Location

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, line = nil) ⇒ Location

Returns a new instance of Location.



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

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

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



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

def file
  @file
end

#lineObject (readonly)

Returns the value of attribute line.



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

def line
  @line
end

Class Method Details

.from_path(path) ⇒ Object



10
11
12
13
14
15
# File 'lib/watchr/location.rb', line 10

def self.from_path(path)
  file, line = path.split(':')
  line = line && line.to_i

  Location.new(file, line)
end