Class: Caffeinate::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/caffeinate/configuration.rb

Overview

Global configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/caffeinate/configuration.rb', line 39

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
end

Instance Attribute Details

#async_deliveryObject

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_classObject

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_sizeObject

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_reasonObject

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_reasonObject

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_laterObject

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_pathObject

The path to the drippers



27
28
29
# File 'lib/caffeinate/configuration.rb', line 27

def drippers_path
  @drippers_path
end

#implicit_campaignsObject

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

#nowObject

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

Returns:

  • (Boolean)


65
66
67
# File 'lib/caffeinate/configuration.rb', line 65

def async_delivery?
  @async_delivery
end

#deliver_later?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/caffeinate/configuration.rb', line 69

def deliver_later?
  @deliver_later
end

#implicit_campaigns?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/caffeinate/configuration.rb', line 57

def implicit_campaigns?
  @implicit_campaigns
end

#time_nowObject



61
62
63
# File 'lib/caffeinate/configuration.rb', line 61

def time_now
  @now.call
end