def to_tmpfiles
      unless @media.blank?
        media_file = Tempfile.new 'media'
        media_file.binmode
        media_file.write compile_media.to_s
        media_file.rewind
      end

      scenario_file = Tempfile.new 'scenario'
      scenario_file.write to_xml(:pcap_path => media_file.try(:path))
      scenario_file.rewind

      {scenario: scenario_file, media: media_file}
    end
def to_tmpfiles
      unless @media.blank?
        media_file = Tempfile.new 'media'
        media_file.binmode
        media_file.write compile_media.to_s
        media_file.rewind
      end

      scenario_file = Tempfile.new 'scenario'
      scenario_file.write to_xml(:pcap_path => media_file.try(:path))
      scenario_file.rewind

      {scenario: scenario_file, media: media_file}
    end
Write compiled Scenario XML and PCAP media (if applicable) to tempfiles.

 These will automatically be closed and deleted once they have gone out of scope, and can be used to execute the scenario without leaving stuff behind.

 @return [Hash<Symbol => Tempfile>] handles to created Tempfiles at :scenario and :media

 @see http://www.ruby-doc.org/stdlib-1.9.3/libdoc/tempfile/rdoc/Tempfile.html