aboutsummaryrefslogtreecommitdiffstats
path: root/lib/attachment_to_html/view.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/attachment_to_html/view.rb')
-rw-r--r--lib/attachment_to_html/view.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/attachment_to_html/view.rb b/lib/attachment_to_html/view.rb
new file mode 100644
index 000000000..5cdd3823b
--- /dev/null
+++ b/lib/attachment_to_html/view.rb
@@ -0,0 +1,27 @@
+module AttachmentToHTML
+ class View < ERB
+
+ def self.template
+ @template || "#{ File.dirname(__FILE__) }/template.html.erb"
+ end
+
+ def self.template=(path)
+ @template = path
+ end
+
+ attr_accessor :title, :body, :template, :wrapper
+
+ def initialize(adapter, opts = {})
+ self.title = adapter.title
+ self.body = adapter.body
+ self.template = opts.fetch(:template, self.class.template)
+ self.wrapper = opts.fetch(:wrapper, 'wrapper')
+ super(File.read(template))
+ end
+
+ def render
+ result(binding)
+ end
+
+ end
+end