From: Ilmari Heikkinen Date: 2005-01-24T07:40:05+09:00 Subject: Re: [ANN] IHelp 0.2.0 --Apple-Mail-10--636226293 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Hi, thanks for the feedback :) On 23.1.2005, at 14:00, Csaba Henk wrote: > Is there a way to get the formatted help (in either format), without > superflouos conversions? > > I could do > > rio=IHelp.ri_driver.instance_variable_get(:@options) > rio.use_stdout=true > > and then maybe I could capture the output somehow, but that's a bit too > much hack. (I want things like concatenating various help informations, > like the help for all the String methods.) > Yes, I think it's possible. Looked at what RI is doing, and it seems to me that this is the simplest way to go (if there are any RDoc gurus reading this, please tell if there's a better way.) And yes, it's a hack. -- Ilmari Heikkinen --Apple-Mail-10--636226293 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="string_methods_help.rb" Content-Disposition: attachment; filename=string_methods_help.rb require 'ihelp' require 'stringio' s = StringIO.new # get the formatter formatter = RI::Options.instance.formatter # hack the formatter [:puts, :print, :write].each{|method_name| formatter.send(:define_method, method_name){|*args| self.class.out.send(method_name, *args) } } class << formatter; attr_accessor :out end formatter.out = s RI::Options.instance.use_stdout = true # collect formatted help into s String.methods.each{|m| String.help(m)} RI::Options.instance.use_stdout = false formatter.out = STDOUT s.rewind str = s.read # display the big collected help doc RI::Options.instance.displayer.instance_eval{ page{ puts str } } --Apple-Mail-10--636226293--