Class: Fixnum

Inherits:
Object show all
Defined in:
lib/strokedb/core_ext/fixnum.rb

Overview

extracted and adapted from ActiveSupport (rubyforge.org/projects/activesupport/)

Instance Method Summary collapse

Instance Method Details

#even?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/strokedb/core_ext/fixnum.rb', line 8

def even?
  multiple_of? 2
end

#multiple_of?(number) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/strokedb/core_ext/fixnum.rb', line 4

def multiple_of?(number)
  self % number == 0
end

#odd?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/strokedb/core_ext/fixnum.rb', line 12

def odd?
  !even?
end