Date calculator in Ruby