Sha256: 6aefd4911f356b5ebc755afc9d4bf802e4b72d2ee374782d432fcc7e9d907edf
Contents?: true
Size: 710 Bytes
Versions: 19
Compression:
Stored size: 710 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
19 entries across 19 versions & 1 rubygems