Class: Vail::Translate

Inherits:
Object
  • Object
show all
Defined in:
lib/vail/translate.rb

Constant Summary collapse

Morse =
{
  "a" => [Dot, Dash],
  "b" => [Dash, Dot, Dot, Dot],
  "c" => [Dash, Dot, Dash, Dot],
  "d" => [Dash, Dot, Dot],
  "e" => [Dot],
  "f" => [Dot, Dot, Dash, Dot],
  "g" => [Dash, Dash, Dot],
  "h" => [Dot, Dot, Dot, Dot],
  "i" => [Dot, Dot],
  "j" => [Dot, Dash, Dash, Dash ],
  "k" => [Dash, Dot, Dash ],
  "l" => [Dot, Dash, Dot, Dot],
  "m" => [Dash, Dash],
  "n" => [Dash, Dot],
  "o" => [Dash, Dash, Dash],
  "p" => [Dot, Dash, Dash, Dot],
  "q" => [Dash, Dash, Dot, Dash],
  "r" => [Dot, Dash, Dot],
  "s" => [Dot, Dot, Dot], 
  "t" => [Dash], 
  "u" => [Dot, Dot, Dash], 
  "v" => [Dot, Dot, Dot, Dash], 
  "w" => [Dot, Dash, Dash],
  "x" => [Dash, Dot, Dot, Dash],
  "y" => [Dash, Dot, Dash, Dash],
  "z" => [Dash, Dash, Dot, Dot],
  "0" => [Dash,Dash,Dash,Dash,Dash],
  "1" => [Dot, Dash, Dash, Dash, Dash],
  "2" => [Dot, Dot, Dash, Dash, Dash],
  "3" => [Dot, Dot, Dot, Dash, Dash],
  "4" => [Dot, Dot, Dot, Dot, Dash],
  "5" => [Dot, Dot, Dot, Dot, Dot],
  "6" => [Dash, Dot, Dot, Dot, Dot],
  "7" => [Dash, Dash, Dot, Dot, Dot], 
  "8" => [Dash, Dash, Dash, Dot, Dot],
  "9" => [Dash, Dash, Dash, Dash, Dot]
}

Class Method Summary collapse

Class Method Details

.to_morse(letter) ⇒ Object



41
42
43
# File 'lib/vail/translate.rb', line 41

def self.to_morse(letter)
  Morse[letter.downcase] || []
end