-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use simpler interface for emitting warnings, and add shim for Console…
… gem.
- Loading branch information
Showing
3 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
# Released under the MIT License. | ||
# Copyright, 2024, by Samuel Williams. | ||
|
||
module Async | ||
# Shims for the console gem, redirecting warnings and above to `Kernel#warn`. | ||
# | ||
# If you require this file, the `async` library will not depend on the `console` gem. | ||
# | ||
# That includes any gems that sit within the `Async` namespace. | ||
# | ||
# This is an experimental feature. | ||
module Console | ||
def self.debug(...) | ||
end | ||
|
||
def self.info(...) | ||
end | ||
|
||
def self.warn(*arguments, exception: nil, **options) | ||
if exception | ||
super(*arguments, exception.full_message, **options) | ||
else | ||
super(*arguments, **options) | ||
end | ||
end | ||
|
||
def self.error(...) | ||
self.warn(...) | ||
end | ||
|
||
def self.fatal(...) | ||
self.warn(...) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters