module Uncruft::Warning
Constants
- DEPRECATION_PATTERN
Public Instance Methods
warn(str, *args)
click to toggle source
Calls superclass method
# File lib/uncruft/warning.rb, line 5 def warn(str, *args) if str =~ DEPRECATION_PATTERN # rubocop:disable Performance/RegexpMatch message = strip_caller_info(str, caller_locations(1..1).first).strip ActiveSupport::Deprecation.warn(message) else super end end
Private Instance Methods
strip_caller_info(str, cloc)
click to toggle source
# File lib/uncruft/warning.rb, line 16 def strip_caller_info(str, cloc) str.sub(cloc.to_s, '') # try full caller information first .gsub(/#{cloc.path}(:#{cloc.lineno})?:?\s*/, '') # try path with optional line end