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
backlog-0.3.8 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.3.9 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.4.0 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.5.0 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.5.1 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.5.10 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.5.2 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.5.4 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.5.3 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.5.6 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.5.5 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.5.7 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.5.8 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.5.9 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.6.1 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.6.2 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.6.0 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.6.5 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.6.3 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.6.4 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb