fix: console args conflict with gets

main
Artem-Darius Weber 4 months ago
parent 0dcfbe642a
commit 706790e55e

@ -1,17 +1,18 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
LANGUAGES = [ LANGUAGES = [
"ru-RU", "ru-RU",
"en-EN", "en-EN",
"de-DE" "de-DE"
] ]
def main() def main()
user_name = ARGV[0] user_name = ARGV[0]
puts "Hello my catgirl #{user_name}! \n What is your love language?" puts "Hello my catgirl #{user_name}! \nWhat is your love language?"
LANGUAGES.each { |language| puts "#{language}", " " } LANGUAGES.each { |language| puts "#{language}", " " }
user_lang = gets.chomp
user_lang = "ruby" user_lang = STDIN.gets.chomp
case user_lang case user_lang
when "ruby" when "ruby"
puts "Подлиза \n" puts "Подлиза \n"
@ -21,9 +22,9 @@ def main()
puts "Фронтендер, Фууу! \n" puts "Фронтендер, Фууу! \n"
when "py" when "py"
puts "Девопсер, иди ДАГИ писать \n" puts "Девопсер, иди ДАГИ писать \n"
else
puts "Неизвестный язык: #{user_lang}"
end end
end end
main() main()

Loading…
Cancel
Save