 
   "#{(@ / 1000000000).truncate()} GB"
 
+Number::ordinalize = ->
+  s = ['th', 'st', 'nd', 'rd']
+  v = @ % 100
+  @ + (s[(v - 20) % 10] or s[v] or 'th')
+
+Number::truncate = (digits = 2) ->
+  @toFixed(digits).replace(/\.?0+$/, '')
+
 String::capitalize = ->
   @charAt(0).toUpperCase() + @slice(1)
 
 String::dasherize = ->
   @replace /_/g, '-'
-
-# Example:
-#   'hello {planet}'.format(planet: 'world') # => 'Hello world'
-String::format = ->
-  e = @toString()
-
-  return e if not arguments.length
-
-  n = if typeof(arguments[0]) in ['string', 'number']
-    Array.prototype.slice.call(arguments)
-  else
-    arguments[0]
-
-  e.replace /{([^}]+)}/g, (match, key) ->
-    if typeof n[key] is 'undefined' then match else n[key]
 
 String::humanize = ->
   @.replace(/[a-z][A-Z]/, (match) -> "#{match[0]} #{match[1]}")

    @replace /(\d{3})(\d{4})/, '$1-$2'
  else
    @

String::presence = ->
  if @isBlank() then null else @

Number::accountingFormat = ->
  if @ < 0 then "($#{(@ * -1).toFixed(2)})" else "$#{@.toFixed(2)}"

Number::bytesToString = ->
  return "#{@} B" if @ < 1000

