Forum: Ruby Re: ruby syntax

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
60365eeb0142d2c6597a921efbfa8c28?d=identicon&s=25 v. nainar (Guest)
on 2006-03-31 09:16
(Received via mailing list)
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
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-04-01 01:49
(Received via mailing list)
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.
This topic is locked and can not be replied to.