0
저는 크리스 파인 (Chris Pine)의 6 장 농담을했습니다. 매우 읽기 쉽지만 DRY 원칙을 위반하는지 궁금합니다. 그렇다면 어떻게 리팩토링 할 수 있습니까?리팩토링하여 더 건조하게해야합니까?
puts "WHAT DID YOU SAY??"
said = gets.chomp
x = 0
bye_counter = 0
while bye_counter < 3
if said != said.upcase
puts "HUH?! SPEAK UP, SONNY!"
said = gets.chomp
bye_counter = 0
elsif said == said.upcase && said != "BYE"
puts "NO, NOT SINCE " + rand(1930..1950).to_s + "!"
bye_counter = 0
said = gets.chomp
elsif said == "BYE"
puts "HUH??"
bye_counter += 1
break if bye_counter == 3
said = gets.chomp
end
end
puts "OH.. OK!"