From: Eric Hodel Date: 2006-08-29T15:55:56+09:00 Subject: Re: Ruby alias problem On Aug 28, 2006, at 11:49 PM, Alexander Rysenko wrote: > I have a class like this: > > class Control > attr_accessor :name, :parent, :children > > def initialize(name) > self.name = name > @children = Hash.new > end > > def addChild(child) > child.parent = self > @children[child.name] = child > end > > def getChild(name) > @children[name] > end alias [] getChild > end > > So i want to alias method named getChild as []. But Ruby says > "undefined > method `getChild' for class `Control'". How can I make such alias? -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com