Class: Caffeinate::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
11
# File 'lib/caffeinate/configuration.rb', line 7

def initialize
  @now = -> { Time.current }
  @async_delivery = false
  @mailing_job = nil
end

Instance Attribute Details

#async_deliveryObject

Returns the value of attribute async_delivery.



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

def async_delivery
  @async_delivery
end

#mailing_jobObject

Returns the value of attribute mailing_job.



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

def mailing_job
  @mailing_job
end

#nowObject

Returns the value of attribute now.



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

def now
  @now
end

Instance Method Details

#async_delivery?Boolean

If delivery is asyncronous

Returns:

  • (Boolean)


25
26
27
# File 'lib/caffeinate/configuration.rb', line 25

def async_delivery?
  @async_delivery
end

#mailing_job_classObject

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



30
31
32
# File 'lib/caffeinate/configuration.rb', line 30

def mailing_job_class
  @mailing_job.constantize
end

#time_nowObject

The current time, for database calls



20
21
22
# File 'lib/caffeinate/configuration.rb', line 20

def time_now
  @now.call
end