Rule 3221. Offer to compromise. Except in a matrimonial action, at any time not later than ten days before trial, any party against whom a claim is asserted, and against whom a separate judgment may be taken, may serve upon the claimant a written offer to allow judgment to be taken against him for a sum or property or to the effect therein specified, with costs then accrued. If within ten days thereafter the claimant serves a written notice that he accepts the offer, either party may file the summons, complaint and offer, with proof of acceptance, and thereupon the clerk shall enter judgment accordingly. If the offer is not accepted and the claimant fails to obtain a more favorable judgment, he shall not recover costs from the time of the offer, but shall pay costs from that time. An offer of judgment shall not be made known to the jury.