Ruby block variables

Hi Gurus,
After resolving the 2 pass model issue in my recipe, I am facing a new issue. I have added my code (reading a file content) inside a ruby_block where the file content is saved to a variable.

Now I have to generate a file using a template where the above variable is a parameter. But chef throws error saying 'invalid or undefined variable or method error" . What I understood that the variable defined inside the ruby_block is not scoped outside.

Please help me

Babu George