lib/slack_mailer.rb in slack_mailer-0.1.3 vs lib/slack_mailer.rb in slack_mailer-0.1.4

- old
+ new

@@ -1,8 +1,9 @@ require_relative 'slack_mailer/configuration' require_relative 'slack_mailer/delivery_worker' require 'slack-notifier' +require 'erb' module Slack class Mailer class << self @@ -32,12 +33,14 @@ self.class.send(method, channel, "#{self.class.name}##{template}", message) end def collect_message(template, instance_variables) template = "#{template}.#{Slack::Mailer::Configuration.config.templates_type}" - template + '.erb' if Slack::Mailer::Configuration.config.erb_in_templates - ActionView::Base.new("#{Slack::Mailer::Configuration.config.templates_path}/#{self.class.name.underscore}", - {}, ActionController::Base.new).render(file: template, locals: instance_variables || {}) + template << '.erb' if Slack::Mailer::Configuration.config.erb_in_templates + + ERB.new( + File.read("#{Slack::Mailer::Configuration.config.templates_path}/#{self.class.name.underscore}/#{template}") + ).result(binding) end end end