Sha256: 58cf6a80bb610ef793d340eb98c8908136a1a67750eb19f45586bdac176afedb

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

require 'erb'

module MonkeyMail
  module Clients
    class BaseClient
      def render_template(template_name:, vars: {})
        @template_name = template_name
        @vars = vars
        { 'html' => render_fake_template }
      end

      private

      def render_fake_template
        ERB.new(fake_template).result(binding)
      end

      def fake_template
        %(
          <h1> Template: <%= @template_name %> </h1>
          <h2> Variables </h2>
          <ul>
            <% @vars.each do |var| %>
              <li><b><%= var %></b></li>
            <% end %>
          </ul>)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
monkey-mail-0.1.1 lib/monkey_mail/clients/base_client.rb
monkey-mail-0.1.0 lib/monkey_mail/clients/base_client.rb