Module: Abbreviations

Included in:
Action
Defined in:
lib/abbreviations.rb

Instance Method Summary collapse

Instance Method Details

#expand_text(text) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/abbreviations.rb', line 3

def expand_text(text)
  text =~ /\A(\d*)(\S*)/
  numbers = $1
  word = $2.downcase
  expanded_text = (numbers == nil or numbers.empty?) ? ABBREVIATIONS[word] : (ABBREVIATIONS[numbers]+word.capitalize)
  expanded_text == nil ? text : expanded_text.chomp("/")
end