Created
April 13, 2012 08:42
-
-
Save epitron/2375142 to your computer and use it in GitHub Desktop.
Faster RI, with Pry's pager.
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
Pry.commands.command "ri", "RI it up!" do |*names| | |
# lazy loading | |
require 'rdoc/ri/driver' | |
unless RDoc::RI::Driver.responds_to? :monkeypatched? | |
class RDoc::RI::Driver | |
def page | |
lesspipe {|less| yield less} | |
end | |
def formatter(io) | |
if @formatter_klass then | |
@formatter_klass.new | |
else | |
RDoc::Markup::ToAnsi.new | |
end | |
end | |
def monkeypatched? | |
true | |
end | |
end | |
end | |
ri = RDoc::RI::Driver.new :use_stdout => true, :interactive => false | |
ri.display_names names | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment