Module: Xing::Snapshot::Writer
- Included in:
- Fetcher, LocalSiteSnapshot
- Defined in:
- lib/xing/snapshot/writer.rb
Instance Method Summary collapse
Instance Method Details
#write(path, html) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/xing/snapshot/writer.rb', line 4 def write(path, html) snapshot_file = "#{ Rails.root }/public/frontend_snapshots/#{path.present? ? path : 'index'}.html" dirname = File.dirname(snapshot_file) FileUtils.mkdir_p(dirname) File.open(snapshot_file, "w+:ASCII-8BIT:UTF-8") do |f| f.write(html) end end |