39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
From 0b262057287952e4dbd5171bc958eaf709276b29 Mon Sep 17 00:00:00 2001
|
|
From: Sutou Kouhei <kou@clear-code.com>
|
|
Date: Tue, 11 Oct 2022 10:52:48 +0000
|
|
Subject: [PATCH] Make `io/console/size` as optional dependency
|
|
|
|
Because `io/console` family is unavailable on WebAssembly and WASI due
|
|
to missing termio APIs.
|
|
---
|
|
.../gems/power_assert-2.0.1/lib/power_assert/inspector.rb | 8 ++++++--
|
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/.bundle/gems/power_assert-2.0.1/lib/power_assert/inspector.rb b/.bundle/gems/power_assert-2.0.1/lib/power_assert/inspector.rb
|
|
index 50bb646..6a4d8b6 100644
|
|
--- a/.bundle/gems/power_assert-2.0.1/lib/power_assert/inspector.rb
|
|
+++ b/.bundle/gems/power_assert-2.0.1/lib/power_assert/inspector.rb
|
|
@@ -1,5 +1,8 @@
|
|
require 'power_assert/configuration'
|
|
-require 'io/console/size'
|
|
+begin
|
|
+ require 'io/console/size'
|
|
+rescue LoadError
|
|
+end
|
|
|
|
module PowerAssert
|
|
class InspectedValue
|
|
@@ -44,7 +47,8 @@ module PowerAssert
|
|
def inspect
|
|
if PowerAssert.configuration.colorize_message
|
|
if PowerAssert.configuration.inspector == :pp
|
|
- width = [IO.console_size[1] - 1 - @indent, 10].max
|
|
+ console_width = IO.respond_to?(:console_size) ? IO.console_size[1] : 80
|
|
+ width = [console_width - 1 - @indent, 10].max
|
|
IRB::ColorPrinter.pp(@value, '', width)
|
|
else
|
|
IRB::Color.colorize_code(@value.to_s, ignore_error: true)
|
|
--
|
|
2.39.1
|
|
|