ruby integer to boolean

You could use the zero? method. It returns true if 0. If you need to backwards, you could easily negate it to !@system_config.resend.zero?. Or you could extend the Fixnum class, adding a to_b? method, since everything is open and extensible in dynamic languages.

class Integer
  def to_b?
    !self.zero?
  end
end

alt text

Ruby API: http://ruby-doc.org/core/classes/Fixnum.html#M001050

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)