tags:

views:

63

answers:

1

If i have bunch of classes in objectspace and have a list of methods which generated also from objectspace, is there any possibility to fetch rdoc documentation for single method ?

Example:

FILE: foo.rb

# Class rdoc information here
class foo

  # defining bar here, just prints hello world
  def bar
   puts "hello world"
  end
end

FILE: baz.rb

require 'foo.rb'
puts "I want to print out the rdoc portion of method bar here"
A: 

I have a work-a-round but if someone has better solution, please let me know.

Basicly my foo.rb script is executed only when im generating some packaging metadata. And this is executed once per compile cycle. I added a extra target to my makefile which keeps a local ri documentation and then in my foo.rb script i just call ri like this:

FILE:baz.rb

myClassName = "foo" 
myMethoedName = "bar"
caseDoc=`ri -f simple -d ../.ri #{myClassName}##{myMethodName} -T`
puts caseDoc
rasjani