fixed breaking when clause for ruby 1.9.3

This syntax for when clause is no more supported by Ruby version 1.9.3, therefore replacing : by then