Module: R2OAS::Deprecation::Reporting
- Included in:
- R2OAS::Deprecation
- Defined in:
- lib/r2-oas/support/deprecation/reporting.rb
Constant Summary collapse
- FILE_LINE_METHOD_REGEXP =
/^(?<file>.+?):(?<line>\d+)(?::in `(?<method>.*?)')?/.freeze
- R2OAS_GEM_ROOT =
File.('../../../../', __dir__) + '/lib'
Instance Attribute Summary collapse
-
#gem_name ⇒ Object
Returns the value of attribute gem_name.
-
#silenced ⇒ Object
Returns the value of attribute silenced.
Instance Method Summary collapse
- #silence ⇒ Object
- #warn(message = nil, callstack = nil) ⇒ Object (also: #will_remove)
Instance Attribute Details
#gem_name ⇒ Object
Returns the value of attribute gem_name.
8 9 10 |
# File 'lib/r2-oas/support/deprecation/reporting.rb', line 8 def gem_name @gem_name end |
#silenced ⇒ Object
Returns the value of attribute silenced.
8 9 10 |
# File 'lib/r2-oas/support/deprecation/reporting.rb', line 8 def silenced @silenced end |
Instance Method Details
#silence ⇒ Object
23 24 25 26 27 28 |
# File 'lib/r2-oas/support/deprecation/reporting.rb', line 23 def silence old_silenced = silenced self.silenced = true yield if block_given? self.silenced = old_silenced end |
#warn(message = nil, callstack = nil) ⇒ Object Also known as: will_remove
13 14 15 16 17 18 19 20 |
# File 'lib/r2-oas/support/deprecation/reporting.rb', line 13 def warn( = nil, callstack = nil) return if silenced callstack ||= caller_locations(2) (callstack, ).tap do |msg| behavior.each { |b| b.call(msg, callstack, deprecation_horizon, gem_name) } end end |