Module: Tempest::WarningFilter
- Defined in:
- lib/tempest/warning_filter.rb
Overview
Silences the Ruby 4.x experimental warning fired by ‘IO::Buffer`. The warning originates in `<internal:io>` but surfaces through async-dns / `resolv.rb` on the Jetstream WebSocket connect path, and the user cannot act on it. Other warnings, including unrelated `IO::Buffer` references, are forwarded to the original `Warning.warn` so genuine signals still reach stderr.
Constant Summary collapse
- PATTERN =
/IO::Buffer is experimental/
Class Method Summary collapse
Class Method Details
.install! ⇒ Object
20 21 22 23 |
# File 'lib/tempest/warning_filter.rb', line 20 def install! return if Warning.singleton_class.include?(self) Warning.singleton_class.prepend(self) end |
.suppress?(msg) ⇒ Boolean
15 16 17 18 |
# File 'lib/tempest/warning_filter.rb', line 15 def suppress?(msg) return false unless msg.is_a?(String) msg.match?(PATTERN) end |
.warn(msg, **kwargs) ⇒ Object
25 26 27 28 |
# File 'lib/tempest/warning_filter.rb', line 25 def warn(msg, **kwargs) return if Tempest::WarningFilter.suppress?(msg) super end |