Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3486

Re: who can eplain deeply the ruby's methods?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!feeds.phibee-telecom.net!talisker.lacave.net!lacave.net!not-for-mail
From 7stud -- <bbxx789_05ss@yahoo.com>
Newsgroups comp.lang.ruby
Subject Re: who can eplain deeply the ruby's methods?
Date Mon, 25 Apr 2011 19:57:46 -0500
Organization Service de news de lacave.net
Lines 31
Message-ID <7b31d92cd9f02bc49d4ea27e46c14de7@ruby-forum.com> (permalink)
References <999670eb7a464b9d106f84fb7385d075@ruby-forum.com>
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace talisker.lacave.net 1303779501 29636 65.111.164.187 (26 Apr 2011 00:58:21 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Tue, 26 Apr 2011 00:58:21 +0000 (UTC)
In-Reply-To <999670eb7a464b9d106f84fb7385d075@ruby-forum.com>
X-Received-From This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway
X-Mail-Count 382174
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <7b31d92cd9f02bc49d4ea27e46c14de7@ruby-forum.com>
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:3486

Show key headers only | View raw


a) Singleton methods are inserted into an anonymous class immediately 
above the object in the method lookup chain.

b) The methods in an included module are also inserted in an anonymous 
class immediately above the class/module that does the include()'ing.

One tricky part of the method lookup: class methods are inherited by 
subclasses:

class Parent
  def self.greet
    puts 'Hi!'
  end
end

class Child < Parent
  def self.cry
    puts 'Weeep, weep!'
  end
end

Child.cry
Child.greet

--output:--
Weeep, weep!
Hi!

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

who can eplain deeply the ruby's methods? savin max <mafei.198@gmail.com> - 2011-04-24 00:57 -0500
  Re: who can eplain deeply the ruby's methods? Stu <stu@rubyprogrammer.net> - 2011-04-24 03:46 -0500
    Re: who can eplain deeply the ruby's methods? Stu <stu@rubyprogrammer.net> - 2011-04-24 03:58 -0500
    Re: who can eplain deeply the ruby's methods? savin max <mafei.198@gmail.com> - 2011-04-24 08:18 -0500
      Re: who can eplain deeply the ruby's methods? Stu <stu@rubyprogrammer.net> - 2011-04-24 15:53 -0500
        Re: who can eplain deeply the ruby's methods? savin max <mafei.198@gmail.com> - 2011-04-24 22:10 -0500
  Re: who can eplain deeply the ruby's methods? 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-25 19:35 -0500
  Re: who can eplain deeply the ruby's methods? 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-25 19:57 -0500
    Re: who can eplain deeply the ruby's methods? savin max <mafei.198@gmail.com> - 2011-04-26 05:06 -0500

csiph-web