Skip to content

Instantly share code, notes, and snippets.

@klebervirgilio
Last active December 15, 2015 10:19
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 klebervirgilio/5245156 to your computer and use it in GitHub Desktop.
Save klebervirgilio/5245156 to your computer and use it in GitHub Desktop.
begin
require 'hirb'
rescue LoadError
# Missing goodies, bummer
end
if defined? Hirb
# Slightly dirty hack to fully support in-session Hirb.disable/enable toggling
Hirb::View.instance_eval do
def enable_output_method
@output_method = true
@old_print = Pry.config.print
Pry.config.print = proc do |output, value|
Hirb::View.view_or_page_output(value) || @old_print.call(output, value)
end
end
def disable_output_method
Pry.config.print = @old_print
@output_method = nil
end
end
Hirb.enable
end
class Object
def _mm
case self.class
when Class
self.public_methods.sort - Object.public_methods
when Module
self.public_methods.sort - Module.public_methods
else
self.public_methods.sort - Object.new.public_methods
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment