class Rom2Jap
Public Class Methods
new()
click to toggle source
# File lib/rom2jap.rb, line 8 def initialize TypeWriter.new "Welcome to rom2jap! An app that converts Romaji to Japanese in a simple and easy way! If you liked this app and want to improve it, send me your features or revisions via pull request. Thanks! Cristiano Carvalho (Developer) enjoy it ..." puts "" puts "" puts "Choose an alphabet to start typing:" puts '(h) Hiragana (k) Katakana (help) Docs (q) Quit' options = {'h'=>'Hiragana', 'k'=>'Katakana'} key=ask() while key != 'q' do if key == 'h' then h = Hiragana.new elsif key == 'k' then k = Katakana.new elsif key == '' then puts "No aphabet selected!" elsif key == 'help' then help() elsif !options.has_key?(key) then puts "Invalid option!" end key = ask() end puts 'Sayonara! (ăăăȘă)' end
Public Instance Methods
ask()
click to toggle source
# File lib/rom2jap.rb, line 46 def ask() print("\n>"); gets.chomp.downcase end
help()
click to toggle source
# File lib/rom2jap.rb, line 48 def help TypeWriter.new 'This is our help docs. Follow the instructions bellow and enjoy a good usage experience! rom2jap is an app that allows you to type a letter and gets an output equivalent in the japanese alphabet of your choice.' puts '' puts '' 70.times {|h| print '='} puts '' puts ' rom2jap docs:' puts '' puts '- To start using rom2jap, at first, choose the alphabet' puts "- Type an letter and hit enter and you'll see the equivalent japanese character in output" puts "- Continue typing letters to create your word. Remeber: one letter by time!" puts '- If you want a space, type spacebar and hit enter' puts '- To save your words in a txt file, type save and create a name to your data.' end