Class: CutePrint::Location Private

Inherits:
Object show all
Extended by:
FindsForeignCaller
Defined in:
lib/cute_print/location.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from FindsForeignCaller

lib_path, nearest_foreign_caller

Constructor Details

#initialize(path, line_number) ⇒ Location

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Location.



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

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

Instance Attribute Details

#line_numberObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/cute_print/location.rb', line 16

def line_number
  @line_number
end

#pathObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def path
  @path
end

Class Method Details

.findObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def self.find
  path, line_number = nearest_foreign_caller.split(':')
  line_number = line_number.to_i
  new(path, line_number)
end

Instance Method Details

#filenameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
# File 'lib/cute_print/location.rb', line 23

def filename
  File.basename(@path)
end