class String

Extends String class with to_comma and updated to_i

Public Instance Methods

add_commas() click to toggle source
# File lib/number_name_string.rb, line 32
def add_commas
  self.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
end
old_to_i()
Alias for: to_i
to_comma() click to toggle source
# File lib/number_name_string.rb, line 28
def to_comma
  self.to_i.to_comma
end
to_i() click to toggle source
# File lib/number_name_string.rb, line 36
def to_i
  if self =~ /^\d+$/
    old_to_i
  else
    NumberNameString[self]
  end
end
Also aliased as: old_to_i