Module: XMP2Assert::Renderer
- Included in:
- Assertions
- Defined in:
- lib/xmp2assert/renderer.rb
Overview
Compiles a Quasifile into a separate ruby script.
Instance Method Summary collapse
-
#render(qfile, exception = nil) {|rendered| ... } ⇒ File
Compiles a Quasifile into a separate ruby script.
Instance Method Details
#render(qfile, exception = nil) {|rendered| ... } ⇒ File
Compiles a Quasifile into a separate ruby script. Generated file should be passable to a separate ruby process. This method yields that file if a block is given, and deletes it afterwards. When no block is passed, leaves it undeleted; to clean it up is up to the caller then.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/xmp2assert/renderer.rb', line 62 def render qfile, exception = nil s = erb qfile, exception if defined? yield Tempfile.create '' do |f| f.write s f.flush return yield f end else f = Tempfile.create '' f.write s f.flush return f end end |