Question

I have awesome_print configured to be my default formatter in IRB (using AwesomePrint.irb! in my .irbrc) and while this is normally awesome, I want to turn it off sometimes. Anybody know how to from a running IRB/Rails console?

Was it helpful?

Solution

You can paste this in to you terminal to reset it back to what it was originally if you like:

IRB::Irb.class_eval do
  def output_value # :nodoc:
    printf @context.return_format, @context.inspect_last_value
  end
end

or you can go whole hog and monkey patch AwesomePrint:

module AwesomePrint
  def self.un_irb!
    IRB::Irb.class_eval do
      def output_value # :nodoc:
        printf @context.return_format, @context.inspect_last_value
      end
    end
  end
end

Then just call it whenever you want: AwesomePrint.un_irb!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top