lib/mailkick.rb in mailkick-0.1.3 vs lib/mailkick.rb in mailkick-0.1.4
- old
+ new
@@ -19,13 +19,11 @@
services.each(&:fetch_opt_outs)
end
def self.discover_services
Service.subclasses.each do |service|
- if service.discoverable?
- services << service.new
- end
+ services << service.new if service.discoverable?
end
end
def self.opted_out?(options)
opt_outs(options).any?
@@ -65,13 +63,11 @@
end
if (user = options[:user])
parts << "user_id = ? and user_type = ?"
binds.concat [user.id, user.class.name]
end
- if parts.any?
- relation = relation.where(parts.join(" OR "), *binds)
- end
+ relation = relation.where(parts.join(" OR "), *binds) if parts.any?
relation =
if options[:list]
relation.where("list IS NULL OR list = ?", options[:list])
else
@@ -89,7 +85,7 @@
def self.opted_out_users(options = {})
Set.new(opt_outs(options).where("user_id IS NOT NULL").map(&:user))
end
end
-ActionMailer::Base.send :include, Mailkick::Mailer
+ActionMailer::Base.send(:prepend, Mailkick::Mailer)
ActiveRecord::Base.send(:extend, Mailkick::Model) if defined?(ActiveRecord)