Skip to content

Commit

Permalink
Let IRB::Color.colorable? always return true|false (#940)
Browse files Browse the repository at this point in the history
  • Loading branch information
tompng committed May 1, 2024
1 parent c55474f commit 0bbe435
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/irb/color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ module Color

class << self
def colorable?
supported = $stdout.tty? && (/mswin|mingw/ =~ RUBY_PLATFORM || (ENV.key?('TERM') && ENV['TERM'] != 'dumb'))
supported = $stdout.tty? && (/mswin|mingw/.match?(RUBY_PLATFORM) || (ENV.key?('TERM') && ENV['TERM'] != 'dumb'))

# because ruby/debug also uses irb's color module selectively,
# irb won't be activated in that case.
if IRB.respond_to?(:conf)
supported && IRB.conf.fetch(:USE_COLORIZE, true)
supported && !!IRB.conf.fetch(:USE_COLORIZE, true)
else
supported
end
Expand Down

0 comments on commit 0bbe435

Please sign in to comment.