Approximity blog home
1 of 1 article InfoSyndicate: full/short

ANN: IHelp 0.3.0   26 Feb 05
[print link all ]
Announcing the release of IHelp 0.3.0.

fhtr.org/projects/ihelp/ fhtr.org/projects/ihelp/doc/ fhtr.org/projects/ihelp/releases/ihelp-0.3.0.tar.gz

This release brings with it custom help renderers, which you can leverage to render help whenever you want, wherever you want and however you want.

Also included are a couple experimental renderers (no guarantees):

  • #rubydoc_org opens the corresponding ruby-doc.org class help file using the program defined in IHelp::WWW_BROWSER
  • #rubytoruby_src uses Ryan Davis’ RubyToRuby class to print out the source for the method.

blog.zenspider.com/archives/2005/02/rubytoruby.html for more info about RubyToRuby.

Ri bindings for interactive use from within Ruby. Does a bit of second-guessing (Instance method? Class method? Try both unless explicitly defined. Not found in this class? Try the ancestor classes.)

Goal is that help is given for all methods that have help.

Examples:

  require 'ihelp'

  a = "string"
  a.help
  a.help :reverse
  a.help :map
  String.help
  String.help :new
  String.help :reverse
  String.help :map
  String.instance_help :reverse
  String.instance_help :new # => No help found.
  a.help :new
  help "String#reverse"
  help "String.reverse"
  a.method(:reverse).help # gets help for Method
  help "Hash#map"

Custom help renderers: The help-method calls IHelp::Renderer’s method defined by IHelp.renderer with the RI info object. You can print help out the way you want by defining your own renderer method in IHelp::Renderer and setting IHelp.renderer to the name of the method.

 require 'ihelp'

 class IHelp::Renderer
   def print_name(info)
     puts info.full_name
   end
 end

 IHelp.renderer = :print_name
 [1,2,3].help:reject
 # Array#reject
 # => nil

 

Powered by Rublog