Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Examples of 'Things' that are not Objects in Ruby

Tags:

oop

ruby

"Everything is an object" was one of the first things I learned about Ruby, but in Peter Cooper's Beginning Ruby: From Novice to Professional, it is mentioned that "almost everything in Ruby is an object".

Can you give me some examples of things that are not objects in Ruby?

like image 410
Yaser Sulaiman Avatar asked Jan 06 '09 10:01

Yaser Sulaiman


1 Answers

The most obvious one that jumps into my head would be blocks. Blocks can be easily reified to a Proc object, either by using the &block parameter form in a parameter list or by using lambda, proc, Proc.new or (in Ruby 1.9) the "stabby lambda" syntax. But on its own, they aren't objects.

Another example are operators.

like image 168
Jörg W Mittag Avatar answered Dec 05 '22 07:12

Jörg W Mittag