On Thu, Feb 28, 2013 at 2:02 PM, Tukai Patra <lists / ruby-forum.com> wrote:
> Alex Gutteridge wrote in post #1099529:
>> On 28.02.2013 12:34, Tukai Patra wrote:
> Yes the below one I was looking for if possible or not. Can you explain
> how does it possible? what internal task ruby did for that call?
>
>> foo.baz
>> bar
>>      ==>nil
>
> Sorry I overlooked it :)

The alias keywords creates a new instance method in the class, no
different (from the outside) than any other methods you define on it:


1.9.2p290 :001 > class Test
1.9.2p290 :002?>   def m
1.9.2p290 :003?>     end
1.9.2p290 :004?>   end
 => nil
1.9.2p290 :006 > Test.instance_methods(false)
 => [:m]
1.9.2p290 :007 > class Test
1.9.2p290 :008?>   alias :old_m :m
1.9.2p290 :009?>   end
 => nil
1.9.2p290 :010 > Test.instance_methods(false)
 => [:m, :old_m]

Jesus.