require 'active_support'
require 'delayed/compatibility'
require 'delayed/exceptions'
require 'delayed/message_sending'
require 'delayed/performable_method'
require 'delayed/yaml_ext'
require 'delayed/lifecycle'
require 'delayed/plugin'
require 'delayed/plugins/clear_locks'
require 'delayed/backend/base'
require 'delayed/backend/job_preparer'
require 'delayed/worker'
require 'delayed/deserialization_error'
require 'delayed/railtie' if defined?(Rails::Railtie)

ActiveSupport.on_load(:action_mailer) do
  require 'delayed/performable_mailer'
  ActionMailer::Base.extend(Delayed::DelayMail)
end

module Delayed
  autoload :PerformableMailer, 'delayed/performable_mailer'
end

Object.send(:include, Delayed::MessageSending)
Module.send(:include, Delayed::MessageSendingClassMethods)

require 'active_support'
require 'delayed/compatibility'
require 'delayed/exceptions'
require 'delayed/message_sending'
require 'delayed/performable_method'
require 'delayed/yaml_ext'
require 'delayed/lifecycle'
require 'delayed/plugin'
require 'delayed/plugins/clear_locks'
require 'delayed/backend/base'
require 'delayed/backend/job_preparer'
require 'delayed/worker'
require 'delayed/deserialization_error'
require 'delayed/railtie' if defined?(Rails::Railtie)

ActiveSupport.on_load(:action_mailer) do
  require 'delayed/performable_mailer'
  ActionMailer::Base.extend(Delayed::DelayMail)
  ActionMailer::Parameterized::Mailer.include(Delayed::DelayMail)
end

module Delayed
  autoload :PerformableMailer, 'delayed/performable_mailer'
end

Object.send(:include, Delayed::MessageSending)
Module.send(:include, Delayed::MessageSendingClassMethods)

Make .delay method work with ActionMailer::Parameterized::Mailer
Make .delay method work with ActionMailer::Parameterized::Mailer

This PR unifies the DelayedJob behavior of ActionMailer::Base and ActionMailer::Parameterized::Mailer

Now, the following syntax works equivalently:

```ruby
# works currently
MyMailer.delay.my_method

# this PR makes the following work
MyMailer.with(foo: 1, bar: 2).delay.my_method
```

Note that ActionMailer::Parameterized::Mailer does not inherit ActionMailer::Base (moreover, the `.with()` method returns an object instance, hence we use `include` rather than `extend`)