Skip to content

Instantly share code, notes, and snippets.

@dylanerichards
Last active August 10, 2016 23:38
Show Gist options
  • Save dylanerichards/d6631f8cf42e2cb88dacd0d08c33303c to your computer and use it in GitHub Desktop.
Save dylanerichards/d6631f8cf42e2cb88dacd0d08c33303c to your computer and use it in GitHub Desktop.
class WakaWaka
attr_reader :code
def initialize(code)
@code = code
end
MAPPINGS = {
'<' => 'Waka',
'>' => 'waka',
'!' => 'bang',
"'" => 'tick',
'#' => 'hash',
'^' => 'Caret',
'"' => 'quote',
'`' => 'back-tick',
'$' => 'dollar',
'-' => 'dash',
'!' => 'Bang',
'=' => 'equal',
'@' => 'at',
'_' => 'underscore',
'%' => 'Percent',
'~' => 'tilde',
'4' => 'four',
}
def translate
@code.each do |symbol|
puts "#{symbol}: #{MAPPINGS.fetch(symbol, "unknown symbol")}"
end
end
end
waka_code = WakaWaka.new(["<", ">", "!", "*", "'", "'", "#", "^", '"', "`", "$", "$", "-", "!", "*", "=", "@", "$", "_", "%", "*", "<", ">", "~", "#", "4"])
p waka_code.translate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment