Created
March 13, 2012 22:11
-
-
Save ryancurtin/2032104 to your computer and use it in GitHub Desktop.
Morsels are Delicious
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = %w(.- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --..) | |
z = Hash[*m.zip(("A".."Z").to_a).flatten] | |
arr = [] | |
morse.split(" ").each do |x| | |
x.split(" ").each do |y| | |
arr << z[y] | |
end | |
arr << " " | |
end | |
return arr.join | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment