ruby generator: replace template first before calling user callback