Module: Pry::Warning Private

Defined in:
lib/pry/warning.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • v0.13.0

Class Method Summary collapse

Class Method Details

.warn(message)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Prints a warning message with exact file and line location, similar to how Ruby's -W prints warnings.

Parameters:

  • message (String)

Since:

  • v0.13.0


12
13
14
15
16
17
18
# File 'lib/pry/warning.rb', line 12

def self.warn(message)
  location = caller_locations(2..2).first
  path = location.path
  lineno = location.lineno

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