Sha256: 841e61b27d6f35e60b90995c9c8b95a63b58e71c910e1c26acd36e63aa47bda5

Contents?: true

Size: 706 Bytes

Versions: 2288

Compression:

Stored size: 706 Bytes

Contents

# frozen_string_literal: true

class Pry
  # @api private
  # @since v0.13.0
  module Warning
    # Prints a warning message with exact file and line location, similar to how
    # Ruby's -W prints warnings.
    #
    # @param [String] message
    # @return [void]
    def self.warn(message)
      if Kernel.respond_to?(:caller_locations)
        location = caller_locations(2..2).first
        path = location.path
        lineno = location.lineno
      else
        # Ruby 1.9.3 support.
        frame = caller[1].split(':') # rubocop:disable Performance/Caller
        path = frame.first
        lineno = frame[1]
      end

      Kernel.warn("#{path}:#{lineno}: warning: #{message}")
    end
  end
end

Version data entries

2,288 entries across 2,284 versions & 21 rubygems

Version Path
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/pry-0.13.1/lib/pry/warning.rb
files.com-1.0.1 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
talon_one-2.0.0 vendor/bundle/ruby/2.3.0/gems/pry-0.13.1/lib/pry/warning.rb
talon_one-2.0.0 vendor/bundle/ruby/2.7.0/gems/pry-0.13.1/lib/pry/warning.rb
pry-0.13.1-java lib/pry/warning.rb
pry-0.13.1 lib/pry/warning.rb
pry-0.13.0-java lib/pry/warning.rb
pry-0.13.0 lib/pry/warning.rb