From: bahuvrihi Date: 2008-11-15T01:44:59+09:00 Subject: Re: Getting the comments(RDoc/ri) while running For that exact thing, check out Lazydoc (http://tap.rubyforge.org/ lazydoc/). Lazydoc allows you to register lines at which to pull out documentation, as well as lazy class attributes whose values are pulled from the documentation as needed. require 'rubygems' require 'lazydoc' class Sample # comment for method one def method_one end end doc = Lazydoc[__FILE__] # register by line counting from 0 # or using a regexp #comment = doc.register(5) comment = doc.register(/method_one/) doc.resolve puts comment.subject # => " def method_one" puts comment.content # => "comment for method one" (Note the lazy attributes aren't shown, but examples are in the documentation)