Module: JWT::Deprecations
- Defined in:
- lib/jwt/deprecations.rb
Overview
Deprecations module to handle deprecation warnings in the gem
Class Method Summary collapse
- .context ⇒ Object
- .emit_warnings ⇒ Object
- .store(message) ⇒ Object
- .warning(message, only_if_valid: false) ⇒ Object
Class Method Details
.context ⇒ Object
7 8 9 10 11 |
# File 'lib/jwt/deprecations.rb', line 7 def context yield.tap { emit_warnings } ensure Thread.current[:jwt_warning_store] = nil end |
.emit_warnings ⇒ Object
31 32 33 34 35 |
# File 'lib/jwt/deprecations.rb', line 31 def emit_warnings return if Thread.current[:jwt_warning_store].nil? Thread.current[:jwt_warning_store].each { |warning| warn(warning) } end |
.store(message) ⇒ Object
27 28 29 |
# File 'lib/jwt/deprecations.rb', line 27 def store() (Thread.current[:jwt_warning_store] ||= []) << end |
.warning(message, only_if_valid: false) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/jwt/deprecations.rb', line 13 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 |