Module: MorseCharacters

Included in:
Telegraph
Defined in:
lib/morse_characters.rb

Constant Summary collapse

ITU_Morse =

Official characters from the RECOMMENDATION ITU-R M.1677: International Morse code.

{
"a" => ".-",
"b" => "-...",
"c" => "-.-.",
"d" => "-..",
"e" => ".",
"f" => "..-.",
"g" => "--.",
"h" => "....",
"i" => "..",
"j" => ".---",
"k" => "-.-",
"l" => ".-..",
"m" => "--",
"n" => "-.",
"o" => "---",
"p" => ".--.",
"q" => "--.-",
"r" => ".-.",
"s" => "...",
"t" => "-",
"u" => "..-",
"v" => "...-",
"w" => ".--",
"x" => "-..-",
"y" => "-.--",
"z" => "--..",
"0" => "-----",
"1" => ".----",
"2" => "..---",
"3" => "...--",
"4" => "....-",
"5" => ".....",
"6" => "-....",
"7" => "--...",
"8" => "---..",
"9" => "----.",
"." => ".-.-.-",
"," => "--..--",
":" => "---...",
"?" => "..--..",
"" => ".----.",
"" => "-....-",
"-" => "-....-",
"/" => "-..-.",
"(" => "-.--.",
")" => "-.--.-",
"" => ".-..-.",
"" => ".-..-.",
"\""=> ".-..-.",
"=" => "-...-",
"+" => ".-.-.",
"@" => ".--.-."}
International_extensions =

Some international characters not included in the ITU-R specification.

{
  "ä" => ".-.-",
  "æ" => ".-.-",
  "ą" => ".-.-",
  "à" => ".--.-",
  "å" => ".--.-",
  "ç" => "-.-..",
  "ĉ" => "-.-..",
  "ć" => "-.-..",
  "š" => "----",
  "ĥ" => "----",
  "ð" => "..--.",
  "ś" => "...-...",
  "è" => ".-..-",
  "ł" => ".-..-",
  "é" => "..-..",
  "đ" => "..-..",
  "ę" => "..-..",
  "ĝ" => "--.-.",
  "ĵ" => ".---.",
  "ź" => "--..-.",
  "ñ" => "--.--",
  "Ñ" => "--.--",
  "ń" => "--.--",
  "ö" => "---.",
  "ø" => "---.",
  "ó" => "---.",
  "ŝ" => "...-.",
  "þ" => ".--..",
  "ü" => "..--",
  "ŭ" => "..--",
  "ż" => "--..-"
}
Space_between_words =

The space between morse words is seven spaces.

{" " => "       "}
DOT =

Default dot signal: ‘.’

'.'
DASH =

Default dot signal: ‘-’

'-'
LETTERS_TO_MORSE =

Character mapping to write morse code.

Space_between_words.merge(International_extensions).merge(ITU_Morse)
MORSE_TO_LETTERS =

Character mapping to read morse code.

(Space_between_words.merge(ITU_Morse)).invert
Error =

Prosign for ‘Error’

"........"
Understood =

Prosign for ‘Understood’

"...-."
Invitation_to_transmit =

Prosign for ‘Invitation to transmit’

"-.-"
Wait =

Prosign for ‘Wait’

".-..."
End_of_work =

Prosign for ‘End of work’

"...-.-"
Starting_signal =

Prosign for ‘Starting signal’

"-.-.-"