Sha256: b6a6d4c4bcedc5f19ea89e76242e446cc60e3bc45f2ba6086c8263029feff1ae
Contents?: true
Size: 929 Bytes
Versions: 3
Compression:
Stored size: 929 Bytes
Contents
# frozen_string_literal: true module Infield module Core def warn(*messages, **xargs) super callstack = caller_locations(1 + xargs[:uplevel].to_i) Infield::DeprecationWarning.log(*messages, callstack: callstack, validated: xargs[:category] == :deprecated) end end module InfieldWarningCapture if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0") # Ruby 3.0+ supports warn(msg, category: nil, **kwargs) def warn(msg, category: nil, **kwargs) super Infield::DeprecationWarning.log(msg, callstack: caller_locations, validated: true) if category == :deprecated end else # Ruby < 3.0 only provides a single argument to warn def warn(msg) super Infield::DeprecationWarning.log(msg, callstack: caller_locations, validated: false) end end end Kernel.extend(Core) Warning.extend(InfieldWarningCapture) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
infield-0.5.0 | lib/infield/core_ext.rb |
infield-0.4.0 | lib/infield/core_ext.rb |
infield-0.3.0 | lib/infield/core_ext.rb |