Significance of Kernal.test method?

V

v4 forums

[Note: parts of this message were removed to make it a legal post.]

Hi Team,

I am new to ruby and the best way I found to learn ruby is to walk-through
some of the existing code and try understanding them how it is done.

Recently I came across this following line of code,

test(?e, File.join(dir, file))

Initially, was finding difficult to understand what'z this test is actually
trying to perform on the file and eventually managed to figure out that its
just checking whether the file exists or not. []
I also realized that '?e' is a command to the test method to check if the
file exists. I also see that, in ruby, there is a much understandable and
straight-forward way to achieve the same.

File.exist?

Just curious to know what is the advantage of using the former 'Kernal'
method than using the later 'File' api method.

Thanks
Venkat
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top