aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2019-04-28 21:51:35 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-04-28 21:51:37 +0900
commitf2d7ba6a7473b408002c90b77b021fc837f93561 (patch)
tree74c9b0baba1772685f83b6aa8378e7a6ef1584fb /lib
parent13abf5519a8c00ac2b05409e667c58f05c75123a (diff)
downloadruby-f2d7ba6a7473b408002c90b77b021fc837f93561.tar.gz
make sync-default-gems GEM=irb
from https://github.com/ruby/irb/commit/e8e79d569ed59fe4ed4fbca968917ce799f02a5e. This colorizes Range object on IRB inspect.
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/color.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/irb/color.rb b/lib/irb/color.rb
index aec66cd63e..7af7118849 100644
--- a/lib/irb/color.rb
+++ b/lib/irb/color.rb
@@ -47,17 +47,17 @@ module IRB # :nodoc:
end
def inspect_colorable?(obj)
- if obj.is_a?(Module) && obj.name
- return true
- end
-
case obj
+ when String, Symbol, Regexp, Integer, Float, FalseClass, TrueClass, NilClass
+ true
when Hash
obj.all? { |k, v| inspect_colorable?(k) && inspect_colorable?(v) }
when Array
obj.all? { |o| inspect_colorable?(o) }
- when String, Symbol, Regexp, Integer, Float, FalseClass, TrueClass, NilClass
- true
+ when Range
+ inspect_colorable?(obj.begin) && inspect_colorable?(obj.end)
+ when Module
+ !obj.name.nil?
else
false
end