Skip to content

Instantly share code, notes, and snippets.

@ryancurtin
Created March 13, 2012 22:11
Show Gist options
  • Save ryancurtin/2032104 to your computer and use it in GitHub Desktop.
Save ryancurtin/2032104 to your computer and use it in GitHub Desktop.
Morsels are Delicious
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