この方法が機能しない理由がわかりません。ifステートメントを渡す必要がある値を入力すると、機能しません。
def getBase
puts "What is the base URL for the test?"
x = gets
if (x.include? 'http://') && ((x.split('.').at(x.split('.').length - 1).length) == 3)
return x
else
puts "That is in the incorrect format."
puts "Please format your url like this"
puts "http://example.com"
getBase
end
end
「 http://test.com」を入力してください
結果: ステートメントが繰り返され、再帰を終了しません