module CoreExtensions::Number::Currency

Public Instance Methods

to_satoshi() click to toggle source
# File lib/core_extensions/number/currency.rb, line 4
def to_satoshi
  (self * 1e8).to_i
end
to_token(format: 8) click to toggle source
# File lib/core_extensions/number/currency.rb, line 8
def to_token(format: 8)
  (self.to_i / (10**format).to_f).to_d.to_s('F')
end