Module: FactoryTrace::Helpers::Caller

Defined in:
lib/factory_trace/helpers/caller.rb

Class Method Summary collapse

Class Method Details

.locationString

Returns file and line where the original method was called.

Returns:

  • (String)

    file and line where the original method was called



9
10
11
12
13
14
15
16
# File 'lib/factory_trace/helpers/caller.rb', line 9

def location
  location = caller_locations(2..2).first

  base = Pathname.new(Dir.pwd)
  method = Pathname.new(location.path)

  "#{method.relative_path_from(base)}:#{location.lineno}"
end