A federal appeals court ruled that gay employees are allowed to sue their employers under federal civil-rights law for discrimination on the basis of sexual orientation, an issue that has split courts across the country.