Created
June 3, 2017 15:46
-
-
Save ymsrk/7b1a6cb65b9bb84f966dd160b7652f38 to your computer and use it in GitHub Desktop.
Rails consoleで pryを利用する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require 'hirb' | |
rescue LoadError | |
# Missing goodies, bummer | |
end | |
if defined? Hirb | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment