Module: SexySlug::ShortNumber
- Defined in:
- lib/sexy_slug/short_number.rb
Class Method Summary collapse
Class Method Details
.call(string) ⇒ Object
2 3 4 5 6 |
# 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 |