diff options
Diffstat (limited to 'lib/attachment_to_html/view.rb')
-rw-r--r-- | lib/attachment_to_html/view.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/attachment_to_html/view.rb b/lib/attachment_to_html/view.rb index 5cdd3823b..e6991d44e 100644 --- a/lib/attachment_to_html/view.rb +++ b/lib/attachment_to_html/view.rb @@ -19,9 +19,21 @@ module AttachmentToHTML super(File.read(template)) end - def render + def render(&block) + instance_eval(&block) if block_given? result(binding) end + def content_for(area) + send(area) if respond_to?(area) + end + + private + + def inject_content(area, &block) + instance_variable_set("@#{ area }".to_sym, block.call) + self.class.send(:attr_accessor, area) + end + end end |