mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
44c1316293
* 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
47 lines
802 B
Ruby
47 lines
802 B
Ruby
# frozen_string_literal: false
|
|
#
|
|
# nop.rb -
|
|
# $Release Version: 0.9.6$
|
|
# $Revision$
|
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
|
#
|
|
# --
|
|
#
|
|
#
|
|
#
|
|
module IRB
|
|
# :stopdoc:
|
|
|
|
module ExtendCommand
|
|
class Nop
|
|
|
|
if RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.7.0"
|
|
def self.execute(conf, *opts, **kwargs, &block)
|
|
command = new(conf)
|
|
command.execute(*opts, **kwargs, &block)
|
|
end
|
|
else
|
|
def self.execute(conf, *opts, &block)
|
|
command = new(conf)
|
|
command.execute(*opts, &block)
|
|
end
|
|
end
|
|
|
|
def initialize(conf)
|
|
@irb_context = conf
|
|
end
|
|
|
|
attr_reader :irb_context
|
|
|
|
def irb
|
|
@irb_context.irb
|
|
end
|
|
|
|
def execute(*opts)
|
|
#nop
|
|
end
|
|
end
|
|
end
|
|
|
|
# :startdoc:
|
|
end
|