Skip to content

Instantly share code, notes, and snippets.

@Drowze
Created September 26, 2018 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Drowze/dcda4aee1e3ecf31828cc34269d413d8 to your computer and use it in GitHub Desktop.
Save Drowze/dcda4aee1e3ecf31828cc34269d413d8 to your computer and use it in GitHub Desktop.
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