lib/looksee/inspector.rb in looksee-4.4.0 vs lib/looksee/inspector.rb in looksee-5.0.0
- old
+ new
@@ -18,9 +18,20 @@
lookup_path.entries.reverse.map do |entry|
inspect_entry(entry)
end.join("\n")
end
+ def pretty_print(pp)
+ # In the default IRB inspect mode (pp), IRB assumes that an inspect string
+ # that doesn't look like a bunch of known patterns is a code blob, and
+ # formats accordingly. That messes up our color escapes.
+ if Object.const_defined?(:IRB) && IRB.const_defined?(:ColorPrinter) && pp.is_a?(IRB::ColorPrinter)
+ PP.instance_method(:text).bind(pp).call(inspect)
+ else
+ pp.text(inspect)
+ end
+ end
+
#
# Open an editor at the named method's definition.
#
# Uses Looksee.editor to determine the editor command to run.
#