diff --git a/morse_code.rb b/morse_code.rb index e925868..81d8cec 100644 --- a/morse_code.rb +++ b/morse_code.rb @@ -1,6 +1,6 @@ HASH_MORSE = { '.-' => 'a', - '-..' => 'b', + '-...' => 'b', '-.-.' => 'c', '-..' => 'd', '.' => 'e', @@ -33,7 +33,7 @@ '-....' => '6', '--...' => '7', '---..' => '8', - '----.' => '8', + '----.' => '9', '-----' => '0', '/' => ' ' # Mapping foward bar to be a space } @@ -45,7 +45,7 @@ def get_translated(string_morse) end def mk_morse_code line - line.split('').map{|c| HASH_MORSE.index c.downcase}.join(' ') + line.split('').map{|c| HASH_MORSE.key c.downcase}.join(' ') end private @@ -66,4 +66,4 @@ def translate(string_morse) mc = morse.mk_morse_code('HAHAHA Interesting! Thx PotHix.') puts mc -morse.get_translated mc \ No newline at end of file +morse.get_translated mc