Sha256: 4a0c411e3022f1781b7d057dd3509b161bd9bcc40108c7a3aead68de17f2babf
Contents?: true
Size: 371 Bytes
Versions: 9
Compression:
Stored size: 371 Bytes
Contents
description 'Download aspect' Aspect.create(:download) do def accepts?(page); !page.content.empty?; end def call(context, page) name = page.root? ? :root.t : page.name.gsub(/[^\w.\-_]/, '_') context.header['Content-Disposition'] = %{attachment; filename="#{name}"} context.header['Content-Length'] = page.content.bytesize.to_s page.content end end
Version data entries
9 entries across 9 versions & 1 rubygems