Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #6744
| Newsgroups | comp.lang.ruby |
|---|---|
| Date | 2013-02-13 18:16 -0800 |
| References | <e09ac11905032902331b61cf02@mail.gmail.com> |
| Message-ID | <6719dfa0-b119-4a86-8567-7f415b8197ed@googlegroups.com> (permalink) |
| Subject | Re: Please tell me what this means? self.<method> in a class |
| From | kb9agt@gmail.com |
On Tuesday, March 29, 2005 5:34:07 AM UTC-5, Glenn Smith wrote: > Not entirely sure I understand this (it's a newbie-ruby question). > > class Test > def foo > end > > def Test.foo > end > > def self.foo # self is an instance of the current Object. > end > end > > > The first definitition of foo is an instance method. The second a > class method. Perhaps my terminology is wrong but I understand what I > mean. > > It's the third one I'm not sure of. The "self.foo". > > What does this do, how and where would I use it? Comment out def Test.foo ... end You're already in Test class. Who is self? Think about it. > -- > > All the best > Glenn > Aylesbury, UK
Back to comp.lang.ruby | Previous | Next | Find similar
Re: Please tell me what this means? self.<method> in a class kb9agt@gmail.com - 2013-02-13 18:16 -0800
csiph-web