summaryrefslogtreecommitdiff
path: root/lib/irb/context.rb
diff options
context:
space:
mode:
authorStan Lo <[email protected]>2022-06-28 14:30:36 +0100
committergit <[email protected]>2022-06-28 22:30:42 +0900
commit44c1316293f80abaa0e76b3818322544b9372a97 (patch)
treec560d27798f751ab059b4db59de749dbdd09b1de /lib/irb/context.rb
parent5ccdcd81685cfedd31344690fdb0fd9fc001e3ca (diff)
[ruby/irb] Centralize coloring control (https://github.com/ruby/irb/pull/374)
* Use colorable: argument as the only coloring control * Centalize color controling logic at Color.colorable? There are 2 requirements for coloring output: 1. It's supported on the platform 2. The user wants it: `IRB.conf[:USE_COLORIZE] == true` Right now we check 1 and 2 separately whenever we colorize things. But it's error-prone because while 1 is the default of `colorable` parameter, 2 always need to manually checked. When 2 is overlooked, it causes issues like https://github.com/ruby/irb/pull/362 And there's 0 case where we may want to colorize even when the user disables it. So I think we should merge 2 into `Color.colorable?` so it can be automatically picked up. * Add tests for all inspect modes * Simplify inspectors' coloring logic * Replace use_colorize? with Color.colorable? * Remove Context#use_colorize cause it's redundant https://github.com/ruby/irb/commit/1c53023ac4
Diffstat (limited to 'lib/irb/context.rb')
-rw-r--r--lib/irb/context.rb5
1 files changed, 0 insertions, 5 deletions
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index 0a46c1b1d4..e6c993d423 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -53,7 +53,6 @@ module IRB
else
@use_multiline = nil
end
- @use_colorize = IRB.conf[:USE_COLORIZE]
@use_autocomplete = IRB.conf[:USE_AUTOCOMPLETE]
@verbose = IRB.conf[:VERBOSE]
@io = nil
@@ -186,8 +185,6 @@ module IRB
attr_reader :use_singleline
# Whether colorization is enabled or not.
#
- # A copy of the default <code>IRB.conf[:USE_COLORIZE]</code>
- attr_reader :use_colorize
# A copy of the default <code>IRB.conf[:USE_AUTOCOMPLETE]</code>
attr_reader :use_autocomplete
# A copy of the default <code>IRB.conf[:INSPECT_MODE]</code>
@@ -332,8 +329,6 @@ module IRB
alias use_readline use_singleline
# backward compatibility
alias use_readline? use_singleline
- # Alias for #use_colorize
- alias use_colorize? use_colorize
# Alias for #use_autocomplete
alias use_autocomplete? use_autocomplete
# Alias for #rc