Sha256: 1c175252d025be8264d7c6a8deb650534ca085e1a29599a9f0606cb2bd6baa92

Contents?: true

Size: 496 Bytes

Versions: 86

Compression:

Stored size: 496 Bytes

Contents

module ActiveSupport #:nodoc:
  module CoreExtensions #:nodoc:
    module Integer #:nodoc:
      # For checking if a fixnum is even or odd. 
      # * 1.even? # => false
      # * 1.odd?  # => true
      # * 2.even? # => true
      # * 2.odd? # => false
      module EvenOdd
        def multiple_of?(number)
          self % number == 0
        end
        
        def even?
          multiple_of? 2
        end
        
        def odd?
          !even?
        end
      end
    end
  end
end

Version data entries

86 entries across 86 versions & 6 rubygems

Version Path
radiant-0.6.0 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
radiant-0.6.3 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
radiant-0.6.2 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
radiant-0.6.4 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
rq-3.3.0 rails/vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
rq-3.4.0 rails/vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb