R
Roger Pack
I like docstrings for being able to know what dynamically generated
methods do.
For instance, in rails, there is no documentation for
People.find_by_first_name # it's obvious, but--there is nothing in the
ri to lookup for it. Is it case sensitive? Does it assume defaults for
the other values?
I'd like to suggest docstrings as a nice way to be able to track those.
Especially methods that were created using eval--they are
documentationless.
However, at the same time, now that we have Proc#owner, it would be
possible to "fake it" via something like
module_eval
"@method_name_description = 'a description of the method--it searches
for all instances with a first_name of param1, default to george'
def find_by_first_name
# stuff
end
"
There's also "fastri+irb" which works for non dynamic methods [1], and
also you can lookup the source for non dynamic methods using
#source_location and SCRIPT_LINES__
I was about to make a suggestion to the core fellas to consider
docstrings.
Thoughts on my suggestion?
Thanks much!
-=roger
[1] http://eigenclass.org/hiki/irb+ri+completion
methods do.
For instance, in rails, there is no documentation for
People.find_by_first_name # it's obvious, but--there is nothing in the
ri to lookup for it. Is it case sensitive? Does it assume defaults for
the other values?
I'd like to suggest docstrings as a nice way to be able to track those.
Especially methods that were created using eval--they are
documentationless.
However, at the same time, now that we have Proc#owner, it would be
possible to "fake it" via something like
module_eval
"@method_name_description = 'a description of the method--it searches
for all instances with a first_name of param1, default to george'
def find_by_first_name
# stuff
end
"
There's also "fastri+irb" which works for non dynamic methods [1], and
also you can lookup the source for non dynamic methods using
#source_location and SCRIPT_LINES__
I was about to make a suggestion to the core fellas to consider
docstrings.
Thoughts on my suggestion?
Thanks much!
-=roger
[1] http://eigenclass.org/hiki/irb+ri+completion