Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/core_ext/numeric.rb

Overview

opening the numberic standard class to add 2 methods

Instance Method Summary collapse

Instance Method Details

#to_amountObject

divide by 100



9
10
11
# File 'lib/core_ext/numeric.rb', line 9

def to_amount
  self / 100
end

#to_centsObject

multiply by 100



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

def to_cents
  self * 100
end