building factorial method in Ruby using inject method