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.6.6 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.0 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.1 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.10 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.12 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.11 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.2 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.3 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.5 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.4 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.6 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.7 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.8 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.7.9 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.8.0 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.8.1 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.9.0 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
backlog-0.9.1 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
monetra-ruby-0.0.6 lib/monetra/active_support/core_ext/integer/even_odd.rb
radiant-0.6.1 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb