Sha256: 72199f779679196d9d996c4a7515d84c2927f3d927baf664dfa41adbc21d08bb

Contents?: true

Size: 924 Bytes

Versions: 13

Compression:

Stored size: 924 Bytes

Contents

module Cistern::Coverage
  unless Kernel.respond_to? :caller_locations
    abort <<-ABORT
Cannot enable Cistern coverage reporting

Your ruby version ruby is: #{begin
                               RUBY_VERSION
                             rescue
                               'unknown'
                             end}
`Kernel` does not have the required method `caller_locations`

Try a newer ruby (should be > 2.0)
    ABORT
  end

  # returns the first caller_locations entry before entries in `file`
  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
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cistern-2.8.0 lib/cistern/coverage.rb
cistern-2.7.2 lib/cistern/coverage.rb
cistern-2.7.1 lib/cistern/coverage.rb
cistern-2.7.0 lib/cistern/coverage.rb
cistern-2.6.0 lib/cistern/coverage.rb
cistern-2.5.0 lib/cistern/coverage.rb
cistern-2.4.1 lib/cistern/coverage.rb
cistern-2.4.0 lib/cistern/coverage.rb
cistern-2.3.0 lib/cistern/coverage.rb
cistern-2.2.7 lib/cistern/coverage.rb
cistern-2.2.6 lib/cistern/coverage.rb
cistern-2.2.5 lib/cistern/coverage.rb
cistern-2.2.4 lib/cistern/coverage.rb