Refactor TransformRule to process an array