From: Louis J Scoras [mailto:[email protected]]
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() )