Class: FCSHD::SourceLocation

Inherits:
Struct
  • Object
show all
Defined in:
lib/fcshd/source-location.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#filenameObject

Returns the value of attribute filename

Returns:

  • (Object)

    the current value of filename



4
5
6
# File 'lib/fcshd/source-location.rb', line 4

def filename
  @filename
end

#line_numberObject

Returns the value of attribute line_number

Returns:

  • (Object)

    the current value of line_number



4
5
6
# File 'lib/fcshd/source-location.rb', line 4

def line_number
  @line_number
end

Instance Method Details

#relative_filename(basedir) ⇒ Object



9
10
11
# File 'lib/fcshd/source-location.rb', line 9

def relative_filename(basedir)
  Pathname.new(filename).relative_path_from(Pathname.new(basedir))
end

#to_s(basedir = nil) ⇒ Object



5
6
7
# File 'lib/fcshd/source-location.rb', line 5

def to_s(basedir=nil)
  "#{relative_filename(basedir)}:#{line_number || 0}"
end