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.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/caffeinate/configuration.rb', line 9

def initialize
  @now = -> { Time.current }
  @async_delivery = false
  @deliver_later = false
  @mailing_job = 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

Returns the value of attribute async_delivery.



6
7
8
# File 'lib/caffeinate/configuration.rb', line 6

def async_delivery
  @async_delivery
end

#batch_sizeObject

Returns the value of attribute batch_size.



6
7
8
# File 'lib/caffeinate/configuration.rb', line 6

def batch_size
  @batch_size
end

#default_ended_reasonObject

Returns the value of attribute default_ended_reason.



6
7
8
# File 'lib/caffeinate/configuration.rb', line 6

def default_ended_reason
  @default_ended_reason
end

#default_unsubscribe_reasonObject

Returns the value of attribute default_unsubscribe_reason.



6
7
8
# File 'lib/caffeinate/configuration.rb', line 6

def default_unsubscribe_reason
  @default_unsubscribe_reason
end

#deliver_laterObject

Returns the value of attribute deliver_later.



6
7
8
# File 'lib/caffeinate/configuration.rb', line 6

def deliver_later
  @deliver_later
end

#drippers_pathObject

Returns the value of attribute drippers_path.



6
7
8
# File 'lib/caffeinate/configuration.rb', line 6

def drippers_path
  @drippers_path
end

#implicit_campaignsObject

Returns the value of attribute implicit_campaigns.



6
7
8
# File 'lib/caffeinate/configuration.rb', line 6

def implicit_campaigns
  @implicit_campaigns
end

#mailing_jobObject

Returns the value of attribute mailing_job.



6
7
8
# File 'lib/caffeinate/configuration.rb', line 6

def mailing_job
  @mailing_job
end

#nowObject

Returns the value of attribute now.



6
7
8
# File 'lib/caffeinate/configuration.rb', line 6

def now
  @now
end

Instance Method Details

#async_delivery?Boolean

If delivery is asyncronous

Returns:

  • (Boolean)


38
39
40
# File 'lib/caffeinate/configuration.rb', line 38

def async_delivery?
  @async_delivery
end

#deliver_later?Boolean

If we should use #deliver_later instead of #deliver

Returns:

  • (Boolean)


43
44
45
# File 'lib/caffeinate/configuration.rb', line 43

def deliver_later?
  @deliver_later
end

#implicit_campaigns?Boolean

Automatically create a ::Caffeinate::Campaign object if not found per Dripper.inferred_campaign_slug

Returns:

  • (Boolean)


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

def implicit_campaigns?
  @implicit_campaigns == true
end

#mailing_job_classObject

The @mailing_job constantized. Only used if ‘async_delivery = true`



48
49
50
# File 'lib/caffeinate/configuration.rb', line 48

def mailing_job_class
  @mailing_job.constantize
end

#time_nowObject

The current time, for database calls



33
34
35
# File 'lib/caffeinate/configuration.rb', line 33

def time_now
  @now.call
end