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


Groups > comp.lang.ruby > #3420

who can eplain deeply the ruby's methods?

From savin max <mafei.198@gmail.com>
Newsgroups comp.lang.ruby
Subject who can eplain deeply the ruby's methods?
Date 2011-04-24 00:57 -0500
Organization Service de news de lacave.net
Message-ID <999670eb7a464b9d106f84fb7385d075@ruby-forum.com> (permalink)

Show all headers | View raw


I wants to know the ruby's methods' describe,the relationship between
them,also the mechanism(most wants to know).

what are

methods:
public_methods:
protected_methods:
private_methods:
-----------------------------------------------------------------------------
#e.g(from ruby API 1.9.2)

mod.instance_methods(include_super=true) → array
    Returns an array containing the names of the public and protected
instance methods in the receiver. For a module, these are the public and
protected methods; for a class, they are the instance (not singleton)
methods. With no argument, or with an argument that is false, the
instance methods in mod are returned, otherwise the methods in mod and
mod‘s superclasses are returned.

mod.public_instance_methods(include_super=true) → array
Returns a list of the public instance methods defined in mod. If the
optional parameter is not false, the methods of any ancestors are
included.

mod.protected_instance_methods(include_super=true) → array
Returns a list of the protected instance methods defined in mod. If the
optional parameter is not false, the methods of any ancestors are
included.

mod.private_instance_methods(include_super=true) → array
Returns a list of the private instance methods defined in mod. If the
optional parameter is not false, the methods of any ancestors are
included.


-----------------------------------------------------------------------------

obj.singleton_methods(all=true) → array
Returns an array of the names of singleton methods for obj. If the
optional all parameter is true, the list will include methods in modules
included in obj. Only public and protected singleton methods are
returned.


what's the relationship between these methods?
#e.g.
    String.instance_methods == "str".methods #true
    String.methods(false) == String.singleton_methods(false)  #true
    class method is the singleton method?
....
.....
......

I wants to know the ruby's methods' describe,the relationship between
them,also the mechanism(most wants to know).

who can Explain?
thanks...

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

Back to comp.lang.ruby | Previous | NextNext 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