class Caffeinate::Configuration

Global configuration

Attributes

async_delivery[RW]

If true, enqueues the processing of a ‘Caffeinate::Mailing` to the background worker class as defined in `async_delivery_class`

Default is false

async_delivery_class[RW]

The background worker class for ‘async_delivery`.

batch_size[RW]

The number of ‘Caffeinate::Mailing` records we find in a batch at once.

default_ended_reason[RW]

The default reason for an ended ‘Caffeinate::CampaignSubscription`

default_unsubscribe_reason[RW]

The default reason for an unsubscribed ‘Caffeinate::CampaignSubscription`

deliver_later[RW]

If true, uses ‘deliver_later` instead of `deliver`

drippers_path[RW]

The path to the drippers

enabled_drippers[RW]

An array of Drippers that are enabled. Only used if you use Caffeinate.perform in your worker instead of calling separate drippers. If nil, will run all the campaigns.

implicit_campaigns[RW]

Automatically creates a ‘Caffeinate::Campaign` record by the named slug of the campaign from a dripper if none is found by the slug.

now[RW]

Used for relation to a lot of things. If you have a weird time setup, set this. Accepts anything that responds to ‘#call`; you’ll probably use a block.

Public Class Methods

new() click to toggle source
# File lib/caffeinate/configuration.rb, line 43
def initialize
  @now = -> { Time.current }
  @async_delivery = false
  @deliver_later = false
  @async_delivery_class = nil
  @batch_size = 1_000
  @drippers_path = 'app/drippers'
  @implicit_campaigns = true
  @default_ended_reason = nil
  @default_unsubscribe_reason = nil
  @enabled_drippers = nil
end

Public Instance Methods

async_delivery?() click to toggle source
# File lib/caffeinate/configuration.rb, line 70
def async_delivery?
  @async_delivery
end
deliver_later?() click to toggle source
# File lib/caffeinate/configuration.rb, line 74
def deliver_later?
  @deliver_later
end
implicit_campaigns?() click to toggle source
# File lib/caffeinate/configuration.rb, line 62
def implicit_campaigns?
  @implicit_campaigns
end
now=(val) click to toggle source
# File lib/caffeinate/configuration.rb, line 56
def now=(val)
  raise ArgumentError, '#now must be a proc' unless val.respond_to?(:call)

  @now = val
end
time_now() click to toggle source
# File lib/caffeinate/configuration.rb, line 66
def time_now
  @now.call
end