[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: ruby syntax

v. nainar

3/31/2006 7:14:00 AM

Hi!
I wanted to write this :

infile = File.new("foo")
infile.each do ....

but typed in
infile.read do ...
----
and it ran with no results - and no error messages . After a few minutes of puzzlement
I found it. What does ruby do with the block if the method does not
take one ? . Why doesn't ruby check this kind of errors ?

nainar




1 Answer

Logan Capaldo

3/31/2006 11:48:00 PM

0


On Mar 31, 2006, at 2:14 AM, v. nainar wrote:

> I found it. What does ruby do with the block if the method does not
> take one ? . Why doesn't ruby check this kind of errors ?

It does nothing with the block. I imagine it doesn't check if a
method takes a block because you'd have to inspect the source of the
method everytime to check if it took one or not, since methods can
change.