Module: JWT::Deprecations Private
- Defined in:
- lib/jwt/deprecations.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.
Deprecations module to handle deprecation warnings in the gem
Class Method Summary collapse
- .context ⇒ Object private
- .emit_warnings ⇒ Object private
- .store(message) ⇒ Object private
- .warning(message, only_if_valid: false) ⇒ Object private
Class Method Details
permalink .context ⇒ Object
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.
8 9 10 11 12 |
# File 'lib/jwt/deprecations.rb', line 8 def context yield.tap { emit_warnings } ensure Thread.current[:jwt_warning_store] = nil end |
permalink .emit_warnings ⇒ Object
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.
32 33 34 35 36 |
# File 'lib/jwt/deprecations.rb', line 32 def emit_warnings return if Thread.current[:jwt_warning_store].nil? Thread.current[:jwt_warning_store].each { |warning| warn(warning) } end |
permalink .store(message) ⇒ Object
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.
28 29 30 |
# File 'lib/jwt/deprecations.rb', line 28 def store() (Thread.current[:jwt_warning_store] ||= []) << end |
permalink .warning(message, only_if_valid: false) ⇒ Object
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.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jwt/deprecations.rb', line 14 def warning(, only_if_valid: false) method_name = only_if_valid ? :store : :warn case JWT.configuration.deprecation_warnings when :once return if record_warned() when :warn # noop else return end send(method_name, "[DEPRECATION WARNING] #{}") end |