From: "David A. Black" Date: 2008-04-25T20:52:13+09:00 Subject: Re: "alias name objetc.method" not allowed? --1926193751-1279515851-1209124333=:1568 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-1279515851-1209124333=:1568" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-1279515851-1209124333=:1568 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Fri, 25 Apr 2008, I=C3=B1aki Baz Castillo wrote: > Hi, I've a method that returns an object: > > def object > return @object > end > > That @object is a object of class MyObject containing methods: > > class MyObject > def hello > "helloooooooo" > end > end > > And I'd like to do: > > def object > return @object > end > > alias ob_hello object.hello > > but it's not allowed, that a pity: > unexpected '.' > > So, is not possible to create an alias to a method of a method/object? I think you want: def ob_hello object.hello end David --=20 Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS June 9-12 Berlin ADVANCING WITH RAILS June 16-19 Berlin INTRO TO RAILS June 24-27 London (Skills Matter) See http://www.rubypal.com for details and updates! --1926193751-1279515851-1209124333=:1568-- --1926193751-1279515851-1209124333=:1568--