Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is everything an object in ruby?

Tags:

object

ruby

Is everything in ruby an object? Does this include Fixnums?

like image 599
Andrew Grimm Avatar asked Aug 07 '10 07:08

Andrew Grimm


1 Answers

Depends on what you mean by "everything". Fixnums are, as the others have demonstrated. Classes also are, as instances of class Class. Methods, operators and blocks aren't, but can be wrapped by objects (Proc). Simple assignment is not, and can't. Statements like while also aren't and can't. Comments obviously also fall in the latter group.

Most things that actually matter, i.e. that you would wish to manipulate, are objects (or can be wrapped in objects).

like image 62
Amadan Avatar answered Oct 01 '22 08:10

Amadan