uber icon indicating copy to clipboard operation
uber copied to clipboard

feature request Uber::Configuration

Open timoschilling opened this issue 10 years ago • 0 comments

Some lines of code, saying more then 1000 words.

module Cells::Mailer::Config
  include Uber::Configuration
  configuration_name :mailer
  configuration_instance_name :mailer_config
  configuration_options :from, :to, :subject
end

module Cells::Mailer
  include Cells::Mailer::Config
end

class ApplicationMailerCell
  include Cells::Mailer
  mailer do
    from "[email protected]"
  end
end

class FooMailerCell < ApplicationMailerCell
  mailer do
    subject "Foo"
    # `from` will be inherit from ApplicationMailerCell
  end

  def deliver
    mailer_config # => {from: "[email protected]", subject: "Foo"}
    mailer_config.from # => "[email protected]"
  end
end

timoschilling avatar Nov 07 '15 22:11 timoschilling