I am using the following code to check if a variable is not nil and not zero
if(discount != nil && discount != 0) ... end
Is the
Alternative solution is to use Refinements, like so:
module Nothingness refine Numeric do alias_method :nothing?, :zero? end refine NilClass do alias_method :nothing?, :nil? end end using Nothingness if discount.nothing? # do something end