Module: Mjml::Mailer
- Defined in:
- lib/mjml/mailer.rb
Instance Method Summary collapse
Instance Method Details
#mailer_name ⇒ Object
15 16 17 |
# File 'lib/mjml/mailer.rb', line 15 def mailer_name self.class.name.underscore.sub(/_mailer$/, '') end |
#mjml(headers, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/mjml/mailer.rb', line 3 def mjml(headers, &block) scope = Mjml::Scope.new(self, headers[:template_variables]) headers[:subject] ||= I18n.t("mailers.#{mailer_name}.#{action_name}.subject", headers[:subject_variables]) headers[:template_name] ||= action_name headers[:template_path] ||= "#{Dir.pwd}/app/views/mailers/#{mailer_name}" headers[:body] = mjml_content(headers, scope) headers[:content_type] = "text/html" mail(headers, &block) end |
#t(pharse, args = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/mjml/mailer.rb', line 19 def t(pharse, args = {}) if pharse =~ /\A\./ I18n.t("mailers.#{mailer_name}.#{action_name}#{pharse}", args) else super end end |