L
Leslie Viljoen
Hello
I am new to Ruby, but enjoying it incredibly. I'd like to ask some advice:
I noticed that IO has a "foreach" iterator while Array's, etc. mostly call
their per-item iterators "each". I thought I could get rid of this
inconsistency
like this:
class MyIO<IO
alias :each :foreach
#error:
#: undefined method `foreach' for class `MyIO' (NameError)
end
Why doesn't it work?
Les
--
ruby -W2 -e "puts 'Just another good programmer'"
Leslie Viljoen [[email protected]]
Camary Consulting [http://www.camary.co.za]
Cellphone [083-6186100]
Personal web [http://mobeus.homelinux.org]
I am new to Ruby, but enjoying it incredibly. I'd like to ask some advice:
I noticed that IO has a "foreach" iterator while Array's, etc. mostly call
their per-item iterators "each". I thought I could get rid of this
inconsistency
like this:
class MyIO<IO
alias :each :foreach
#error:
#: undefined method `foreach' for class `MyIO' (NameError)
end
Why doesn't it work?
Les
--
ruby -W2 -e "puts 'Just another good programmer'"
Leslie Viljoen [[email protected]]
Camary Consulting [http://www.camary.co.za]
Cellphone [083-6186100]
Personal web [http://mobeus.homelinux.org]