module Cistern::Coverage

Public Class Methods

find_caller_before(file) click to toggle source

returns the first caller_locations entry before entries in `file`

# File lib/cistern/coverage.rb, line 20
def self.find_caller_before(file)
  enum = caller_locations.each

  call = nil

  # seek to the first entry from within `file`
  while (call = enum.next)
    break if call.path.end_with? file
  end

  # seek to the first entry thats not within `file`
  while (call = enum.next)
    break unless call.path.end_with? file
  end

  # the call location that called in to `file`
  call
end