Class: DepShield::Deprecation
- Inherits:
-
Object
- Object
- DepShield::Deprecation
- Defined in:
- lib/dep_shield/deprecation.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Instance Method Summary collapse
-
#initialize(name:, message:, callstack:) ⇒ Deprecation
constructor
A new instance of Deprecation.
- #raise_or_capture! ⇒ Object
Constructor Details
#initialize(name:, message:, callstack:) ⇒ Deprecation
Returns a new instance of Deprecation.
7 8 9 10 11 |
# File 'lib/dep_shield/deprecation.rb', line 7 def initialize(name:, message:, callstack:) @name = name @stack = cleaner.clean(callstack.map(&:to_s)) @error = DepShield::Error.new("#{name}:\n#{}", stack) end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
5 6 7 |
# File 'lib/dep_shield/deprecation.rb', line 5 def error @error end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/dep_shield/deprecation.rb', line 5 def name @name end |
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
5 6 7 |
# File 'lib/dep_shield/deprecation.rb', line 5 def stack @stack end |
Instance Method Details
#raise_or_capture! ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dep_shield/deprecation.rb', line 13 def raise_or_capture! Rails.logger.warn("NITRO DEPRECATION WARNING") { "#{error}\n#{stack}" } return if DepShield.todos.allowed?(name, stack) raise error unless NitroConfig.get("nitro_errors/capture_deprecation") Sentry.capture_exception( error, tags: { environment: Rails.env, deprecation_error: name } ) end |