Method: FatCore::Numeric#int_if_whole

Defined in:
lib/fat_core/numeric.rb

#int_if_wholeNumeric, Integer

Return an Integer type, but only if the fractional part of self is zero; otherwise just return self.

Examples:

45.98.int_if_whole #=> 45.98
45.000.int_if_whole #=> 45

Returns:

[View source]

120
121
122
# File 'lib/fat_core/numeric.rb', line 120

def int_if_whole
  whole? ? floor : self
end