Sha256: 2a7c56bd1806977c357ecf5f70a737af7b003af7a4b9c03c56a4abedab73711e
Contents?: true
Size: 709 Bytes
Versions: 4
Compression:
Stored size: 709 Bytes
Contents
# frozen_string_literal: true require 'kramdown' require 'erubis' module Lipstick class EmailMessage attr_reader :title, :image_url, :content, :template def initialize(title:, content:, image_url:, template: default_template) @title = title @content = Kramdown::Document.new(content).to_html @image_url = image_url @template = template end def render Erubis::Eruby.new(template).result(binding) end private TEMPLATE_PATH = '../../app/views/layouts/email_branding.html.erb' private_constant :TEMPLATE_PATH def default_template file = File.expand_path(TEMPLATE_PATH, File.dirname(__FILE__)) File.read(file) end end end
Version data entries
4 entries across 4 versions & 1 rubygems