
class Integer

  # Is an integer odd?
  #
  #   2.odd?  #=> false
  #   3.odd?  #=> true
  #
  def odd?
    self % 2 == 1
  end

  # Is an integer even?
  #
  #   2.even?  #=> true
  #   3.even?  #=> false
  #
  def even?
    self % 2 == 0
  end

  # Is is a multiple of a given number?
  #
  #   7.multiple?(2)  #=> false
  #   8.multiple?(2)  #=> true
  #
  def multiple?(number)
    self % number == 0
  end

end


#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCInteger < Test::Unit::TestCase

    def test_odd?
      assert( ! 0.odd? )
      assert(   1.odd? )
      assert( ! 2.odd? )
      assert(   3.odd? )
    end

    def test_even?
      assert(   0.even? )
      assert( ! 1.even? )
      assert(   2.even? )
      assert( ! 3.even? )
    end

    def test_multiple?
      assert( ! 1.multiple?(2) )
      assert(   2.multiple?(2) )
      assert( ! 5.multiple?(3) )
      assert(   6.multiple?(3) )
    end

  end

=end
