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
···
--
ion | power your music
Get your own ion right now at www.ion.co.in !
Alle domenica 1 luglio 2007, Swaroop C H ha scritto:
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
You can look at the online documentation (http://www.ruby-doc.org/core/\) and
at the standard library reference (http://www.ruby-doc.org/stdlib/\).
I hope this helps
Stefano
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"').
Regards
Stefan
···
--
Posted via http://www.ruby-forum.com/\.
You can look at the online documentation
(http://www.ruby-doc.org/core/\) and at the standard library
reference (http://www.ruby-doc.org/stdlib/\). I hope this helps
Stefano
I now realize that I could have referred my PDF copy of 'Programming
Ruby' to see the documentation (which I'll do in future).
But the idea of looking at the websites is not appealing, what if I
wanted to program offline? 
Thanks,
Swaroop
···
--
ion | power your music
Get your own ion right now at www.ion.co.in !
+1 to everything you said here 
Cheers,
Swaroop
···
On 7/1/07, Stefan Rusterholz <apeiros@gmx.net> wrote:
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"').
--
ion | power your music
Get your own ion right now at www.ion.co.in !
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
Interesting, considering the fact that those files are the Ruby standard library, perhaps that is the convention. And I can guess Matz's reasoning: not all file systems are case sensitive. Also, considering the source for Ruby is in C and the tradition there is to use lowercase for .h library files. If all library files are lowercase, there is never a problem with dependencies being broken by such a trivial problem. In many programming environments this has been the very simple source of much trouble.
···
On Jul 1, 2007, at 10:13 AM, Swaroop C H wrote:
On 7/1/07, Stefan Rusterholz <apeiros@gmx.net> wrote:
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"').
Alex Young wrote:
Stefan Rusterholz wrote:
builtin way of doing it.
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.
I keep everything that modifies core classes under a dir called "ruby",
so I do e.g.
require 'ruby/array/sum' (I can also require 'ruby/array', which will
require all sub-files)
I'm still missing a good strategy for singleton methods, though.
Namespaces are mapped to directories in my libs. Stdlib does for a lot
of that the same, consider all the Net::* stuff, it maps to net/*
Regards
Stefan
···
--
Posted via http://www.ruby-forum.com/\.
Build your own version of the rdoc. This is what I did. I also found
on the net a template that made it MUCH prettier and gave me built-in
Javascript-driven search-as-you-type for classes, files and methods,
instead of the ugly frames.
This, I think, is what a ruby programmer is assumed and supposed to do
(I mean, compared to full rdoc html, ri looks like a hack).
Aur
···
On 7/1/07, Tim Hunter <TimHunter@nc.rr.com> wrote:
Swaroop C H wrote:
>> You can look at the online documentation
>> (http://www.ruby-doc.org/core/\) and at the standard library
>> reference (http://www.ruby-doc.org/stdlib/\). I hope this helps
>> Stefano
>
> I now realize that I could have referred my PDF copy of 'Programming
> Ruby' to see the documentation (which I'll do in future).
>
> But the idea of looking at the websites is not appealing, what if I
> wanted to program offline? 
>
> Thanks,
> Swaroop
>
Use a book?
--
RMagick OS X Installer [http://rubyforge.org/projects/rmagick/\]
RMagick Hints & Tips [http://rubyforge.org/forum/forum.php?forum_id=1618\]
RMagick Installation FAQ [http://rmagick.rubyforge.org/install-faq.html\]