Sha256: 270b281839ee3ff1b58a6f507769be98b77cfadbf423c91b092f9771d968054e

Contents?: true

Size: 304 Bytes

Versions: 49

Compression:

Stored size: 304 Bytes

Contents

# frozen_string_literal: true

class Integer
  # Check whether the integer is evenly divisible by the argument.
  #
  #   0.multiple_of?(0)  # => true
  #   6.multiple_of?(5)  # => false
  #   10.multiple_of?(2) # => true
  def multiple_of?(number)
    number != 0 ? self % number == 0 : zero?
  end
end

Version data entries

49 entries across 49 versions & 8 rubygems

Version Path
activesupport-5.2.8.1 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.8 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.7.1 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.7 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.6.3 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.6.2 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.6.1 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.6 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.4.6 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.5 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.4.5 lib/active_support/core_ext/integer/multiple.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.1/lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.4.4 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.4.3 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.4.2 lib/active_support/core_ext/integer/multiple.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.4.1 lib/active_support/core_ext/integer/multiple.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.4 lib/active_support/core_ext/integer/multiple.rb
activesupport-5.2.4.rc1 lib/active_support/core_ext/integer/multiple.rb