lib/email_prefixer/interceptor.rb in email_prefixer-1.1.0 vs lib/email_prefixer/interceptor.rb in email_prefixer-1.2.0.pre.1

- old
+ new

@@ -1,24 +1,15 @@ module EmailPrefixer class Interceptor - extend Forwardable - def_delegators :@configuration, :application_name, :stage_name + attr_reader :configuration - def initialize - @configuration = EmailPrefixer.configuration + def initialize(configuration) + @configuration = configuration end def delivering_email(mail) - mail.subject.prepend(subject_prefix) + prefix = configuration.builder.call + mail.subject.prepend(prefix) end alias_method :previewing_email, :delivering_email - - private - - def subject_prefix - prefixes = [] - prefixes << application_name - prefixes << stage_name.upcase unless stage_name == 'production' - "[#{prefixes.join(' ')}] " - end end end