I
Ilmari Heikkinen
Bit the bullet and finished this little straggler.
If you find bugs, let me know (refactorings also welcome.)
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/91614 is
similar but bound by ri's
default behaviour. Which this one overrides by doing lookups in
ancestors and
instance/class methods. Maybe ri should work like this one does (or
vice versa)?
-Ilmari
========
Download:
http://fhtr.org/code/help.rb
Requirements:
Ri in working order. Works in 1.8.2 at least.
========
# Ri bindings for interactive use from within Ruby.
# Does a bit of second-guessing (Instance method? Class method? Try both
# unless explicitly defined.)
# Goal is getting obj.methods.find_all{|m| not obj.help_yaml(m)} empty.
#
# require 'help'
#
# 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.methodreverse).help # gets help for Method
#
#
# 10 points and a duck drawing for the person who makes the Ri database
# word/regexp/fuzzy/synonym-searchable and integrates this with that.
# Maybe something like this:
# search_help("file open|close")
# => ['Ipen', 'IO.close']
# NOTE: There is NO search_help. Yet. Write it. ]^|
#
#
# License: Ruby's
# Author: Ilmari Heikkinen <kig misfiring net>
# Date: 2004-12-22
If you find bugs, let me know (refactorings also welcome.)
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/91614 is
similar but bound by ri's
default behaviour. Which this one overrides by doing lookups in
ancestors and
instance/class methods. Maybe ri should work like this one does (or
vice versa)?
-Ilmari
========
Download:
http://fhtr.org/code/help.rb
Requirements:
Ri in working order. Works in 1.8.2 at least.
========
# Ri bindings for interactive use from within Ruby.
# Does a bit of second-guessing (Instance method? Class method? Try both
# unless explicitly defined.)
# Goal is getting obj.methods.find_all{|m| not obj.help_yaml(m)} empty.
#
# require 'help'
#
# 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.methodreverse).help # gets help for Method
#
#
# 10 points and a duck drawing for the person who makes the Ri database
# word/regexp/fuzzy/synonym-searchable and integrates this with that.
# Maybe something like this:
# search_help("file open|close")
# => ['Ipen', 'IO.close']
# NOTE: There is NO search_help. Yet. Write it. ]^|
#
#
# License: Ruby's
# Author: Ilmari Heikkinen <kig misfiring net>
# Date: 2004-12-22