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
avalara_sdk-24.12.2 vendor/bundle/ruby/2.7.0/gems/pry-0.13.1/lib/pry/warning.rb
avalara_sdk-24.12.1 vendor/bundle/ruby/2.7.0/gems/pry-0.13.1/lib/pry/warning.rb
avalara_sdk-24.12.0 vendor/bundle/ruby/2.7.0/gems/pry-0.13.1/lib/pry/warning.rb
mux_ruby-3.20.0 vendor/bundle/ruby/3.2.0/gems/pry-0.13.1/lib/pry/warning.rb
mux_ruby-3.19.0 vendor/bundle/ruby/3.2.0/gems/pry-0.13.1/lib/pry/warning.rb
mux_ruby-3.18.0 vendor/bundle/ruby/3.2.0/gems/pry-0.13.1/lib/pry/warning.rb
mux_ruby-3.17.0 vendor/bundle/ruby/3.2.0/gems/pry-0.13.1/lib/pry/warning.rb
mux_ruby-3.15.0 vendor/bundle/ruby/3.2.0/gems/pry-0.13.1/lib/pry/warning.rb
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/pry-0.13.1/lib/pry/warning.rb
mux_ruby-3.14.0 vendor/bundle/ruby/3.2.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-kratos-client-1.1.0 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.6.2 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-hydra-client-2.2.0 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.6.1 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.5.2 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.5.1 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.5.0 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.4.9 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.4.8 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb
ory-client-1.4.7 vendor/bundle/ruby/2.5.0/gems/pry-0.13.1/lib/pry/warning.rb