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
ory-hydra-client-2.1.1 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-hydra-client-2.1.0 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.24 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.23 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.22 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-oathkeeper-client-0.40.2 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.21 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.20 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.19 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.18 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
primary_connect_proto-0.20.0 vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/warning.rb
primary_connect_proto-0.20.0 vendor/bundle/ruby/3.0.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-keto-client-0.11.0.alpha0 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
mux_ruby-3.9.0 vendor/bundle/ruby/3.2.0/gems/pry-0.13.1/lib/pry/warning.rb
primary_connect_proto-0.19.0 vendor/bundle/ruby/3.0.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.17 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.16 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.15 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.14 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.1.13 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb