# Everything in ruby is an object?

**URL:** <https://www.ruby-forum.com/t/everything-in-ruby-is-an-object/107497>\
**Category:** Ruby\
**Created:** [June 22, 2007, 9:57am UTC](https://www.ruby-forum.com/t/everything-in-ruby-is-an-object/107497 "2007-06-22T09:57:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bowenmark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/dc4da7/32.png) [@bowenmark](https://www.ruby-forum.com/u/bowenmark)\
**Post date:** [June 22, 2007, 9:57am UTC](https://www.ruby-forum.com/t/everything-in-ruby-is-an-object/107497/1 "2007-06-22T09:57:48Z")

</div>

Hey folks,

```
  I'm reading the tutorial on Ruby located at

```

[http://www.rubycentral.com/book/](http://www.rubycentral.com/book/)

In it the guys state that everything in Ruby is an object.  
I was just wondering if that applies to Boolean expressions  
i.e. the likes of && and ||. Is there a wrapper object for these  
types? I’ve written a small expression filter that retrieves a boolean  
expression from the db and I was just wondering if there was a quicker  
way of processing it other than a case statement.

Thanks,  
Mark.

---

<div class="post-metadata">

**Author:** ![bowenmark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/dc4da7/32.png) [@bowenmark](https://www.ruby-forum.com/u/bowenmark)\
**Post date:** [June 22, 2007, 10:57am UTC](https://www.ruby-forum.com/t/everything-in-ruby-is-an-object/107497/2 "2007-06-22T10:57:53Z")

</div>

On 6/22/07, Mark G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> types? I’ve written a small expression filter that retrieves a boolean  
> expression from the db and I was just wondering if there was a quicker  
> way of processing it other than a case statement.
> 
> Thanks,  
> Mark.

No. Expressions are not objects. Objects are true and false, and && ||  
are methods.  
Expressions are series of calls.

---

<div class="post-metadata">

**Author:** ![bowenmark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/dc4da7/32.png) [@bowenmark](https://www.ruby-forum.com/u/bowenmark)\
**Post date:** [June 22, 2007, 11:05am UTC](https://www.ruby-forum.com/t/everything-in-ruby-is-an-object/107497/3 "2007-06-22T11:05:54Z")

</div>

On 22.06.2007 09:57, Mark G. wrote:

> ```
> I'm reading the tutorial on Ruby located at
> 
> ```
> 
> [http://www.rubycentral.com/book/](http://www.rubycentral.com/book/)
> 
> In it the guys state that everything in Ruby is an object.  
> I was just wondering if that applies to Boolean expressions  
> i.e. the likes of && and ||. Is there a wrapper object for these  
> types?

No expression in Ruby is an object. But results of evaluating them are  
objects. There is no real boolean type in Ruby as the rule is “nil and  
false are false, everything else is true”.

> I’ve written a small expression filter that retrieves a boolean  
> expression from the db and I was just wondering if there was a quicker  
> way of processing it other than a case statement.

Not sure what you are at here. Can you show a short example of what you  
are doing? (Not the DB retrieval but the postprocessing)

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![bowenmark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/dc4da7/32.png) [@bowenmark](https://www.ruby-forum.com/u/bowenmark)\
**Post date:** [June 22, 2007, 11:16am UTC](https://www.ruby-forum.com/t/everything-in-ruby-is-an-object/107497/4 "2007-06-22T11:16:12Z")

</div>

Jano S. wrote:

> On 6/22/07, Mark G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > types? I’ve written a small expression filter that retrieves a boolean  
> > expression from the db and I was just wondering if there was a quicker  
> > way of processing it other than a case statement.
> > 
> > Thanks,  
> > Mark.
> 
> No. Expressions are not objects. Objects are true and false, and && ||  
> are methods.  
> Expressions are series of calls.

I think && is NOT method:  
1.try:  
class A  
def &&  
end  
end

#parse error, unexpected tANDOP def && ^

2.& is a method,but && is not.because ruby eval method’s arg

---

<div class="post-metadata">

**Author:** ![bowenmark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/dc4da7/32.png) [@bowenmark](https://www.ruby-forum.com/u/bowenmark)\
**Post date:** [June 22, 2007, 11:42am UTC](https://www.ruby-forum.com/t/everything-in-ruby-is-an-object/107497/5 "2007-06-22T11:42:05Z")

</div>

Thanks a million folks. That answers that I guess.  
i’m not going to go about developing a class that will effectively just  
mimic the case statement.

Would you guys know of any all in introduction to ruby on rails??

I’ve been working with JRuby for the past few weeks and would love to  
see how  
applicable it is to enterprise apps.

Thanks,  
Mark.

---

<div class="post-metadata">

**Author:** ![bowenmark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/dc4da7/32.png) [@bowenmark](https://www.ruby-forum.com/u/bowenmark)\
**Post date:** [June 22, 2007, 1:05pm UTC](https://www.ruby-forum.com/t/everything-in-ruby-is-an-object/107497/6 "2007-06-22T13:05:10Z")

</div>

Mark G. wrote:

> Thanks a million folks. That answers that I guess.  
> i’m not going to go about developing a class that will effectively just  
> mimic the case statement.
> 
> Would you guys know of any all in introduction to ruby on rails??
> 
> I’ve been working with JRuby for the past few weeks and would love to  
> see how  
> applicable it is to enterprise apps.

Rails? What’s Rails?

Seriously, there’s a whole web site devoted to RoR: [www.rubyonrails.org](http://www.rubyonrails.org).  
Lots of suggestions about tutorials and books there. Also there’s a  
whole newsgroup devoted to Rails: [http://www.ruby-forum.com/forum/3](http://www.ruby-forum.com/forum/3).  
It’s full of people who like to talk about Rails stuff.
