Sha256: f0fc7f7f6c0e17b32fa08ceebf18c17e5c28b3a06d139789b8b37cd81d971604

Contents?: true

Size: 1.32 KB

Versions: 21

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

require 'forwardable'

require 'emailbutler/version'
require 'emailbutler/engine'
require 'emailbutler/configuration'
require 'emailbutler/dsl'
require 'emailbutler/webhooks/receiver'
require 'emailbutler/helpers'
require 'emailbutler/mailers/helpers'

module Emailbutler
  extend self
  extend Forwardable

  # Public: Given an adapter returns a handy DSL to all the emailbutler goodness.
  def new(adapter)
    DSL.new(adapter)
  end

  # Public: Configure emailbutler.
  #
  #   Emailbutler.configure do |config|
  #     config.adapter = Emailbutler::Adapters::ActiveRecord.new
  #   end
  #
  def configure
    yield configuration
  end

  # Public: Returns Emailbutler::Configuration instance.
  def configuration
    @configuration ||= Configuration.new
  end

  # Public: Default per thread emailbutler instance if configured.
  # Returns Emailbutler::DSL instance.
  def instance
    Thread.current[:emailbutler_instance] ||= new(configuration.adapter)
  end

  # Public: All the methods delegated to instance. These should match the interface of Emailbutler::DSL.
  def_delegators :instance,
                 :adapter, :build_message, :set_message_attribute, :save_message, :find_message_by,
                 :update_message, :count_messages_by_status, :find_messages_by, :resend_message, :destroy_message
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
emailbutler-0.7.6 lib/emailbutler.rb
emailbutler-0.7.5 lib/emailbutler.rb
emailbutler-0.7.4 lib/emailbutler.rb
emailbutler-0.7.3 lib/emailbutler.rb
emailbutler-0.7.2 lib/emailbutler.rb
emailbutler-0.7.1 lib/emailbutler.rb
emailbutler-0.7.0 lib/emailbutler.rb
emailbutler-0.6.1 lib/emailbutler.rb
emailbutler-0.6.0 lib/emailbutler.rb
emailbutler-0.5.9 lib/emailbutler.rb
emailbutler-0.5.8 lib/emailbutler.rb
emailbutler-0.5.7 lib/emailbutler.rb
emailbutler-0.5.6 lib/emailbutler.rb
emailbutler-0.5.5 lib/emailbutler.rb
emailbutler-0.5.4 lib/emailbutler.rb
emailbutler-0.5.3 lib/emailbutler.rb
emailbutler-0.5.2 lib/emailbutler.rb
emailbutler-0.5.1 lib/emailbutler.rb
emailbutler-0.5.0 lib/emailbutler.rb
emailbutler-0.4.0 lib/emailbutler.rb