"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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With