Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/power_assert/inspector.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
require 'power_assert/configuration'
require 'io/console/size'
begin
require 'io/console/size'
rescue LoadError
end

module PowerAssert
class InspectedValue
Expand Down Expand Up @@ -44,7 +47,8 @@ def initialize(value, indent)
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)
Expand Down