module SexySlug::ShortNumber

Public Class Methods

call(string) click to toggle source
# File lib/sexy_slug/short_number.rb, line 2
def self.call(string)
  words = SexySlug.t('number.word')
  pattern = /(?<=\s|^)#{Regexp.union(words.keys)}(?=\s|$)/
  string.gsub(pattern) { |match| words[match] }
end