# Ruby help

**URL:** <https://www.ruby-forum.com/t/ruby-help/196786>\
**Category:** Ruby\
**Created:** [August 20, 2008, 12:17pm UTC](https://www.ruby-forum.com/t/ruby-help/196786 "2008-08-20T12:17:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 20, 2008, 12:17pm UTC](https://www.ruby-forum.com/t/ruby-help/196786/1 "2008-08-20T12:17:20Z")

</div>

Can someone enlighten me about

```
* Public Instance Methods.
* Public Class Methods.
* What is the root class for all Ruby Classes if there is one.
```

---

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [August 20, 2008, 1:49pm UTC](https://www.ruby-forum.com/t/ruby-help/196786/2 "2008-08-20T13:49:14Z")

</div>

2008/8/20 Sunny B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> Can someone enlighten me about
> 
> - Public Instance Methods.
> - Public Class Methods.
> - What is the root class for all Ruby Classes if there is one.

This is a little vague, but I’ll try to help. In Ruby, Object is the  
root  
class, and all classes (even Object) are instances of the Class class.  
Class  
inherits from Module, which inherits from Object.

Object  
^  
|  
Module  
^  
|  
Class

So Object, Module and Class are all Classes, and are also all Objects.  
Hope  
that makes sense.

Public instance methods are defined within a class and can be called on  
instances of the class:

class Foo  
def talk  
‘talking’  
end  
end

f = Foo.new  
f.talk #=\> ‘talking’

Class methods are defined on the class itself (notice the use of self):

class Foo  
def self.something  
self.name  
end  
end

Foo.something #=\> ‘Foo’

‘Public’ just means that a method can be called from outside the object  
by  
any other piece of code. Private methods can only be called inside an  
object  
by other methods in the same class.
