add .when method