Class: TLDR::Location

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



2
3
4
# File 'lib/tldr/value/location.rb', line 2

def file
  @file
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



2
3
4
# File 'lib/tldr/value/location.rb', line 2

def line
  @line
end

Instance Method Details

#locatorObject



11
12
13
# File 'lib/tldr/value/location.rb', line 11

def locator
  "#{relative}:#{line}"
end

#relativeObject



3
4
5
6
7
8
9
# File 'lib/tldr/value/location.rb', line 3

def relative
  if file.start_with?(Dir.pwd)
    file[Dir.pwd.length + 1..]
  else
    file
  end
end