Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Suppressing undesired gem/library load. Useful when your project has a undesired gem being loaded. This makes advantage of .pryrc (but irbrc could theorically also be used)

My project .pryrc contained awesome_print load, which I do not appreciate.

require 'awesome_print'
AwesomePrint.pry!

To patch against the .pryrc, which I could not edit at the time, I created another .pryrc at my home folder (~/.pryrc):

module Kernel
  alias :old_require :require
  def require(path)
    old_require(path) unless path == 'awesome_print'
  end
end

class AwesomePrint; def self.pry!; end; end

This is a hack, but just works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment