Module: WarningSigns::RubyDeprecationCatcher

Includes:
CallerHelper
Defined in:
lib/warning_signs/ruby_deprecation_catcher.rb

Instance Method Summary collapse

Methods included from CallerHelper

#caller_filtered, #ignore_line

Instance Method Details

#augmented_message(message, category) ⇒ Object



14
15
16
17
# File 'lib/warning_signs/ruby_deprecation_catcher.rb', line 14

def augmented_message(message, category)
  category_part = category.present? ? " #{category.upcase}: " : ": "
  "RUBY WARNING#{category_part}#{message} called from #{caller_filtered.first}"
end

#warn(message, category: nil) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/warning_signs/ruby_deprecation_catcher.rb', line 5

def warn(message, category: nil)
  Deprecation.new(
    augmented_message(message, category),
    source: "ruby",
    category: category,
    backtrace: caller
  ).invoke
end