Sha256: e46b5729a6282cdc374c042fe100f2160405b3319983240b0a25280b3c9e5619

Contents?: true

Size: 528 Bytes

Versions: 19

Compression:

Stored size: 528 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 if RUBY_VERSION < '1.9'

        def odd?
          !even?
        end if RUBY_VERSION < '1.9'
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 4 rubygems

Version Path
activesupport-2.0.2 lib/active_support/core_ext/integer/even_odd.rb
activesupport-2.0.5 lib/active_support/core_ext/integer/even_odd.rb
activesupport-2.0.4 lib/active_support/core_ext/integer/even_odd.rb
radiant-0.6.5.1 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
radiant-0.6.5 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
radiant-0.6.6 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
radiant-0.6.7 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
radiant-0.6.8 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
radiant-0.6.9 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
spree-0.0.9 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
spree-0.2.0 vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb
swivel-0.0.150 vendor/activesupport-2.0.2-/lib/active_support/core_ext/integer/even_odd.rb
swivel-0.0.149 vendor/activesupport-2.0.2-/lib/active_support/core_ext/integer/even_odd.rb
swivel-0.0.160 vendor/activesupport-2.0.2-/lib/active_support/core_ext/integer/even_odd.rb
swivel-0.0.175 vendor/activesupport-2.0.2-/lib/active_support/core_ext/integer/even_odd.rb
swivel-0.0.155 vendor/activesupport-2.0.2-/lib/active_support/core_ext/integer/even_odd.rb
swivel-0.0.152 vendor/activesupport-2.0.2-/lib/active_support/core_ext/integer/even_odd.rb
swivel-0.0.157 vendor/activesupport-2.0.2-/lib/active_support/core_ext/integer/even_odd.rb
swivel-0.0.156 vendor/activesupport-2.0.2-/lib/active_support/core_ext/integer/even_odd.rb