Class: Numeric

Inherits:
Object show all
Defined in:
lib/core.rb

Overview

Few helper functions

Instance Method Summary collapse

Instance Method Details

#decObject



173
174
175
# File 'lib/core.rb', line 173

def dec
  - 1
end

#even?Boolean

Returns:

  • (Boolean)


157
158
159
160
161
162
# File 'lib/core.rb', line 157

def even?
  if self % 2 == 0
    return true
  end
  return false
end

#incObject



170
171
172
# File 'lib/core.rb', line 170

def inc
  + 1
end

#to_bObject



163
164
165
166
167
168
169
# File 'lib/core.rb', line 163

def to_b
  if self == 0
    return false
  else
    return true
  end
end