module Diecut::CallerLocationsPolyfill

Constants

FakeLocation

:nocov:

LINE_RE

Public Instance Methods

caller_locations(range, length=nil) click to toggle source

covers exactly the use cases we need

# File lib/diecut/caller-locations-polyfill.rb, line 8
def caller_locations(range, length=nil)
  caller[range.begin+1..range.end+1].map do |line|
    if m = LINE_RE.match(line)
      FakeLocation.new(m.named_captures.values_at("absolute_path", "lineno", "label"))
    end
  end
end