From d57ca2a22579df4c634d554989c0ee9e4ebb5165 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 17 Mar 2014 11:15:40 +0000 Subject: Add AttachmentToHTML library Extracts the attachment processing from FoiAttachment#body_to_html AttachmentToHTML contains adapters which convert - text/plain - application/pdf - application/rtf Results are returned as an AttachmentHTML::HTML instance which contains the raw HTML and other metadata about the conversion. --- lib/attachment_to_html/html.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/attachment_to_html/html.rb (limited to 'lib/attachment_to_html/html.rb') diff --git a/lib/attachment_to_html/html.rb b/lib/attachment_to_html/html.rb new file mode 100644 index 000000000..44d095be8 --- /dev/null +++ b/lib/attachment_to_html/html.rb @@ -0,0 +1,14 @@ +require 'forwardable' +module AttachmentToHTML + class HTML + extend Forwardable + + def_delegator :@adapter, :to_html, :to_s + def_delegator :@adapter, :success? + + def initialize(adapter) + @adapter = adapter + end + + end +end -- cgit v1.2.3