class SpellingAlphabet::ICAO

Word set for ICAO Radiotelephony Alphabet. www.icao.int/Pages/AlphabetRadiotelephony.aspx

Constants

LETTER_WORD
WORD_LETTER
WORD_TABLE

Public Class Methods

interpret(text) click to toggle source

Converts each word to the original letter.

# File lib/spelling_alphabet/icao.rb, line 47
def self.interpret(text)
  text.split(" ").map {|w| WORD_LETTER.fetch(w, w)}.join("")
end
spellout(text) click to toggle source

Converts each letter to the corresponding word.

# File lib/spelling_alphabet/icao.rb, line 42
def self.spellout(text)
  text.delete(" ").chars.map {|c| LETTER_WORD.fetch(c.upcase, c)}.join(" ")
end