From: Alex Fenton Date: 2005-07-20T18:05:55+09:00 Subject: Re: Trying to alias for/foreach > class MyIO > alias :each :foreach > #error: > #: undefined method `foreach' for class `MyIO' (NameError) > > end IO.foreach is a _class_ method, not an instance method. It's a shortcut, called like this: IO.foreach(portname) { ... } vs the instance method - which already exists - which is used like this: IO.new(int, modestring).each { ... } Given that an instance method already exists called 'each', you probably don't want to create a class method with the same name - it's confusing. But if you did class MyIO < IO class << self alias :each :foreach end end alex