Sha256: 1753aed883293855f72b9cfb020ce266ccfbae64f539a2a31eb810679d152dfd

Contents?: true

Size: 274 Bytes

Versions: 13

Compression:

Stored size: 274 Bytes

Contents

class Integer

  # Is +self+ a multiple of a given number?
  #
  #   7.multiple?(2)  #=> false
  #   8.multiple?(2)  #=> true
  #
  # CREDIT: Trans

  def multiple?(number)
    if number.zero?
      zero? ? true : false
    else
      self % number == 0
    end
  end

end

Version data entries

13 entries across 12 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/integer/multiple.rb
facets-3.1.0 lib/core/facets/integer/multiple.rb
facets-3.0.0 lib/core/facets/integer/multiple.rb
facets-2.9.3 lib/core/facets/integer/multiple.rb
facets-2.9.2 src/core/facets/integer/multiple.rb
facets-2.9.2 lib/core/facets/integer/multiple.rb
facets-2.9.1 lib/core/facets/integer/multiple.rb
facets-2.9.0 lib/core/facets/integer/multiple.rb
facets-2.9.0.pre.2 lib/core/facets/integer/multiple.rb
facets-2.9.0.pre.1 lib/core/facets/integer/multiple.rb
facets-2.8.4 lib/core/facets/integer/multiple.rb
facets-2.8.3 lib/core/facets/integer/multiple.rb
facets-2.8.2 lib/core/facets/integer/multiple.rb