.yardoc/objects/ActionMailer/Base/mail_i.dat in mail_engine-0.1.6 vs .yardoc/objects/ActionMailer/Base/mail_i.dat in mail_engine-0.1.7

- old
+ new

@@ -1,21 +1,43 @@ -o:$YARD::CodeObjects::MethodObject:@visibility: public:@source_type: ruby: @scope: instance: @source" def mail(headers={}, &block) +o:$YARD::CodeObjects::MethodObject:@current_file_has_commentsF: +@linei +: @scope: instance:@docstringIC:YARD::Docstring" :@ref_tags[: @objectu:YARD::StubProxyActionMailer::Base#mail: @summary0: @all":@line_range0: +@tags[:@parameters[[" headers"{}[" &block0:@namespaceu;ActionMailer::Base: @files[["+lib/mail_engine/action_mailer_patch.rbi +: +@name: mail: @dynamicT: +@path"ActionMailer::Base#mail:@visibility: public:@source_type: ruby:@signature"!def mail(headers={}, &block): @source"Cdef mail(headers={}, &block) # order by latest uploaded, for get the latest updated 'subject' current_template = MailEngine::MailTemplate.where(:path => "#{controller_path}/#{action_name}", :locale => I18n.locale, :partial => false).order("updated_at desc").first - headers[:subject] = current_template.subject if headers[:subject].blank? && current_template.present? + + # {'username' => @username, 'gender' => @gender} + instance_variable_hash = {} + self.instance_variables.each { |var| instance_variable_hash[var.sub(/^@/,'')] = self.instance_variable_get(var) } + + headers[:subject] = Liquid::Template.parse(current_template.subject).render(instance_variable_hash) if current_template.present? headers[:message_id] = "#{controller_path}/#{action_name}" + unless block_given? + puts "\e[1;31;40m[Mail Engine Warning]\e[0m Please pass a block to 'mail' method as below style, + mail engine needs you to specify the format to send: + \e[1;34;40m + mail :to => 'xxx@xxx.com' do |format| + format.text + format.html + end + \e[0m" + end + # Add sendgrid header before sending mail. # Why here but not add to default_params of action_mailer? because the receiver email [:to] only can get here. if self.sendgrid_config - self.sendgrid_config.add_to headers[:to] + # if add "replacement_email" option in config + receiver = if defined?(::MailSafe::Config) and ::MailSafe::Config.replacement_address + ::MailSafe::Config.get_replacement_address(headers[:to]) + else + headers[:to] + end + self.sendgrid_config.set_send_to receiver origin_mail(headers.merge(self.sendgrid_config.to_hash), &block) else origin_mail(headers, &block) end -end:@explicitT: -@tags[:@current_file_has_commentsF: -@linei -:@signature"!def mail(headers={}, &block): @files[["+lib/mail_engine/action_mailer_patch.rbi -: -@name: mail: -@path"ActionMailer::Base#mail:@docstringIC:YARD::Docstring" : @all":@line_range0;[:@ref_tags[: @summary0: @objectu:YARD::StubProxyActionMailer::Base#mail:@namespaceu;ActionMailer::Base: @dynamicT:@parameters[[" headers"{}[" &block0 +end:@explicitT;[ \ No newline at end of file