Class: Caffeinate::Configuration
- Inherits:
-
Object
- Object
- Caffeinate::Configuration
- Defined in:
- lib/caffeinate/configuration.rb
Overview
Global configuration
Instance Attribute Summary collapse
-
#async_delivery ⇒ Object
If true, enqueues the processing of a
Caffeinate::Mailingto the background worker class as defined inasync_delivery_class. -
#async_delivery_class ⇒ Object
The background worker class for
async_delivery. -
#batch_size ⇒ Object
The number of
Caffeinate::Mailingrecords we find in a batch at once. -
#default_ended_reason ⇒ Object
The default reason for an ended
Caffeinate::CampaignSubscription. -
#default_unsubscribe_reason ⇒ Object
The default reason for an unsubscribed
Caffeinate::CampaignSubscription. -
#deliver_later ⇒ Object
If true, uses
deliver_laterinstead ofdeliver. -
#drippers_path ⇒ Object
The path to the drippers.
-
#enabled_drippers ⇒ Object
An array of Drippers that are enabled.
-
#implicit_campaigns ⇒ Object
Automatically creates a
Caffeinate::Campaignrecord by the named slug of the campaign from a dripper if none is found by the slug. -
#now ⇒ Object
Used for relation to a lot of things.
Instance Method Summary collapse
- #async_delivery? ⇒ Boolean
- #deliver_later? ⇒ Boolean
- #implicit_campaigns? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #time_now ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
43 44 45 46 47 48 49 50 51 52 53 54 |
# 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 |
Instance Attribute Details
#async_delivery ⇒ Object
If true, enqueues the processing of a Caffeinate::Mailing to the background worker class as defined in async_delivery_class
Default is false
15 16 17 |
# File 'lib/caffeinate/configuration.rb', line 15 def async_delivery @async_delivery end |
#async_delivery_class ⇒ Object
The background worker class for async_delivery.
18 19 20 |
# File 'lib/caffeinate/configuration.rb', line 18 def async_delivery_class @async_delivery_class end |
#batch_size ⇒ Object
The number of Caffeinate::Mailing records we find in a batch at once.
24 25 26 |
# File 'lib/caffeinate/configuration.rb', line 24 def batch_size @batch_size end |
#default_ended_reason ⇒ Object
The default reason for an ended Caffeinate::CampaignSubscription
34 35 36 |
# File 'lib/caffeinate/configuration.rb', line 34 def default_ended_reason @default_ended_reason end |
#default_unsubscribe_reason ⇒ Object
The default reason for an unsubscribed Caffeinate::CampaignSubscription
37 38 39 |
# File 'lib/caffeinate/configuration.rb', line 37 def default_unsubscribe_reason @default_unsubscribe_reason end |
#deliver_later ⇒ Object
If true, uses deliver_later instead of deliver
21 22 23 |
# File 'lib/caffeinate/configuration.rb', line 21 def deliver_later @deliver_later end |
#drippers_path ⇒ Object
The path to the drippers
27 28 29 |
# File 'lib/caffeinate/configuration.rb', line 27 def drippers_path @drippers_path end |
#enabled_drippers ⇒ Object
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.
41 42 43 |
# File 'lib/caffeinate/configuration.rb', line 41 def enabled_drippers @enabled_drippers end |
#implicit_campaigns ⇒ Object
Automatically creates a Caffeinate::Campaign record by the named slug of the campaign from a dripper if none is found by the slug.
31 32 33 |
# File 'lib/caffeinate/configuration.rb', line 31 def implicit_campaigns @implicit_campaigns end |
#now ⇒ Object
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.
9 10 11 |
# File 'lib/caffeinate/configuration.rb', line 9 def now @now end |
Instance Method Details
#async_delivery? ⇒ Boolean
70 71 72 |
# File 'lib/caffeinate/configuration.rb', line 70 def async_delivery? @async_delivery end |
#deliver_later? ⇒ Boolean
74 75 76 |
# File 'lib/caffeinate/configuration.rb', line 74 def deliver_later? @deliver_later end |
#implicit_campaigns? ⇒ Boolean
62 63 64 |
# File 'lib/caffeinate/configuration.rb', line 62 def implicit_campaigns? @implicit_campaigns end |
#time_now ⇒ Object
66 67 68 |
# File 'lib/caffeinate/configuration.rb', line 66 def time_now @now.call end |