Skip to content

Instantly share code, notes, and snippets.

@epitron
Created April 13, 2012 08:42
Show Gist options
  • Save epitron/2375142 to your computer and use it in GitHub Desktop.
Save epitron/2375142 to your computer and use it in GitHub Desktop.
Faster RI, with Pry's pager.
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