Fallback to $stdout.tty? unless respond_to?(:tty?).

This commit is contained in:
Markus Reiter 2016-10-02 08:19:06 +02:00
parent a89dc33834
commit 5ee6df6d82

View File

@ -4,7 +4,7 @@ module Kernel
def puts_columns(*objects, gap_size: 2)
objects.flatten!
if objects.empty? || (respond_to?(:tty?) && !tty?)
if objects.empty? || (respond_to?(:tty?) ? !tty? : !$stdout.tty?)
puts(*objects)
return
end