New to Ruby

G

GGarramuno

Hi, I am new to Ruby, albeit I have lots of programming experience on
other scripting languages such as tcl, perl and python.
I think that ruby1.8 is finally comming of age and I am already
falling in love with it, as it seems to have the best of perl and
python.

As a new user, here are my questions:

1) Is there anything like dir() in python? This function allows you
to take any object and list all the methods available.
Thus, dir("") would return all the String methods(length, etc) for
example.


2) The only English docs (for ruby 1.6( mention that ruby1.8 should
have the ability to get rid of the perlish way of passing unordered
named values, but use more of a python syntax perhaps.

That is, calling a function or method more like:

def f(t=1,a=2)
"#{t} #{a}"
end

f(a=1)
Is this possible now? What syntax?


3) In-line documentation? Are there any guidelines to document
functions, classes, etc? It seems ruby comes with some form of inline
docs called RDoc? But I cannot find any docs for it, neither with ri
nor online.

4) Is Ruby 64-bit compatible (ie. can it be compiled for Linux64 or
the Windows64 AMD betas)?
 
T

ts

G> 1) Is there anything like dir() in python? This function allows you
G> to take any object and list all the methods available.
G> Thus, dir("") would return all the String methods(length, etc) for
G> example.

There are the methods Module#{,public_,private_,protected_}instance_methods

For example

String.instance_methods

Same for Kernel#{,singleton_,public_,private_,protected_}methods

for example

"".methods

G> Is this possible now? What syntax?

not yet

G> 3) In-line documentation? Are there any guidelines to document
G> functions, classes, etc? It seems ruby comes with some form of inline
G> docs called RDoc? But I cannot find any docs for it, neither with ri
G> nor online.

If you have 1.8.1, try

rdoc -h

ri

and see the document

ruby-1.8.1/lib/rdoc/README


G> 4) Is Ruby 64-bit compatible (ie. can it be compiled for Linux64 or
G> the Windows64 AMD betas)?

no problem with sparcv9 and ia64


Guy Decoux
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top