templates/dotfiles/.pryrc in onotole-1.1.15 vs templates/dotfiles/.pryrc in onotole-1.1.16
- old
+ new
@@ -1,8 +1,25 @@
-require 'hirb'
+begin
+ require 'hirb'
+rescue LoadError
+ # Missing goodies, bummer
+end
-Hirb.enable
+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 |*args|
+ Hirb::View.view_or_page_output(args[1]) || @old_print.call(*args)
+ end
+ end
-old_print = Pry.config.print
-Pry.config.print = proc do |*args|
- Hirb::View.view_or_page_output(args[1]) || old_print.call(*args)
+ def disable_output_method
+ Pry.config.print = @old_print
+ @output_method = nil
+ end
+ end
+
+ Hirb.enable
end