aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
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