module JWT::Deprecations

Deprecations module to handle deprecation warnings in the gem

Public Class Methods

warning(message) click to toggle source
# File lib/jwt/deprecations.rb, line 7
def warning(message)
  case JWT.configuration.deprecation_warnings
  when :warn
    warn("[DEPRECATION WARNING] #{message}")
  when :once
    return if record_warned(message)

    warn("[DEPRECATION WARNING] #{message}")
  end
end

Private Class Methods

record_warned(message) click to toggle source
# File lib/jwt/deprecations.rb, line 20
def record_warned(message)
  @warned ||= []
  return true if @warned.include?(message)

  @warned << message
  false
end