Alex Young
7/1/2007 4:27:00 PM
Stefan Rusterholz wrote:
> Swaroop C H wrote:
>> Hi all,
>>
>> If there's a class StringScanner, I run 'ri StringScanner' and read
>> the documentation on how to use it, but nowhere it mentions the
>> 'require' line needed, how do we usually find it out? I had to google
>> to find out that `require 'strscan'` is the line needed...
>>
>> When I asked about this on IRC, they said run ` egrep -r
>> 'StringScanner' /usr/lib/ruby/1.8`, but I was really hoping there's a
>> builtin way of doing it.
>>
>> Thanks,
>> Swaroop
>
> I'd vote for having the require line obligatory for stdlib libraries
> documentation. I'd also appreciate it, if at least stdlib would follow
> the convention for file names. Unless I'm mistaken and having filenames
> all lowercase of the class isn't a convention (then I'd vote for coming
> up with a convention).
> I don't think it's that hard to put a proxy file in for all
> unconventional libs requiring the file following the convention to keep
> backwards-compatibility (e.g. strscan.rb just containing a line 'require
> "stringscanner.rb"').
In general, I agree, and this precise problem has annoyed the hell out
of me in the past. However, you also need to take into account those
libraries that provide more than one class or namespace, or those that
primarily modify core classes. It's not insurmountable, by any means.
--
Alex