# Re: ruby way to say this?

**URL:** <https://www.ruby-forum.com/t/re-ruby-way-to-say-this/72534>\
**Category:** Ruby\
**Created:** [October 17, 2006, 9:50pm UTC](https://www.ruby-forum.com/t/re-ruby-way-to-say-this/72534 "2006-10-17T21:50:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [October 17, 2006, 9:50pm UTC](https://www.ruby-forum.com/t/re-ruby-way-to-say-this/72534/1 "2006-10-17T21:50:31Z")

</div>

From: Louis J Scoras [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

> So your original would look like:
> 
> ```
> # if_zero(one_thing, other_thing)
> 
> ```

Let’s make that more OO-pretty (using a goofy name):

class Numeric  
def or\_if\_zero( alternate\_value )  
self.nonzero? ? self : alternate\_value  
end  
end

Which makes the code:

oneThing().or\_if\_zero( otherThing() )
