Skip to content

Instantly share code, notes, and snippets.

@miguelperez
Last active October 6, 2015 19:18
Show Gist options
  • Save miguelperez/3040979 to your computer and use it in GitHub Desktop.
Save miguelperez/3040979 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
LETTERS = {
:a => 'ka',
:b => 'zu',
:c => 'mi',
:d => 'te',
:e => 'ku',
:f => 'lu',
:g => 'ji',
:h => 'r',
:i => 'ki',
:j => 'zu',
:k => 'me',
:l => 'ta',
:m => 'rin',
:n => 'to',
:o => 'mo',
:p => 'no',
:q => 'ke',
:r => 'shi',
:s => 'ari',
:t => 'chi',
:u => 'do',
:v => 'ru',
:w => 'mei',
:x => 'na',
:y => 'fu',
:z => 'zi'
}
unless ARGV.empty?
result = ''
ARGV.each do |name|
name.gsub(/[^\w]?\d?_?/i, "").downcase.each_char do |letter|
result += LETTERS[letter.to_sym]
end
result += " "
end
puts "Your name #{ARGV.join(" ")} is spelled #{result} in ninja!"
else
puts "Correct ussage is ruby ninja.rb juan perez"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment