Sha256: 1a4888272794da92a4835fd117a99d09710483a174ac14003c0a1f3f5e11ee98

Contents?: true

Size: 345 Bytes

Versions: 2

Compression:

Stored size: 345 Bytes

Contents

class Integer
  # Check whether the integer is evenly divisible by the argument.
  def multiple_of?(number)
    self % number == 0
  end

  # Is the integer a multiple of 2?
  def even?
    multiple_of? 2
  end unless method_defined?(:even?)

  # Is the integer not a multiple of 2?
  def odd?
    !even?
  end unless method_defined?(:odd?)
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
activesupport-3.0.pre lib/active_support/core_ext/integer/even_odd.rb
recliner-0.0.1 vendor/activesupport/lib/active_support/core_ext/integer/even_odd.rb