Class: Decode::Location

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

Overview

Represents a location in a source file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, line) ⇒ Location

Initialize a new location.



12
13
14
15
# File 'lib/decode/location.rb', line 12

def initialize(path, line)
  @path = path
  @line = line
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line.



21
22
23
# File 'lib/decode/location.rb', line 21

def line
  @line
end

#pathObject (readonly)

Returns the value of attribute path.



18
19
20
# File 'lib/decode/location.rb', line 18

def path
  @path
end

#The line number in the source file.(linenumber) ⇒ Object (readonly)



21
# File 'lib/decode/location.rb', line 21

attr :line

#The path to the source file.(pathtothesourcefile.) ⇒ Object (readonly)



18
# File 'lib/decode/location.rb', line 18

attr :path

Instance Method Details

#to_sObject

Generate a string representation of the location.



24
25
26
# File 'lib/decode/location.rb', line 24

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