Class: Caffeinate::Drip
- Inherits:
-
Object
- Object
- Caffeinate::Drip
- Defined in:
- lib/caffeinate/drip.rb
Overview
A Drip object
Handles the block and provides convenience methods for the drip
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#dripper ⇒ Object
readonly
Returns the value of attribute dripper.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#enabled?(mailing) ⇒ Boolean
Checks if the drip is enabled.
-
#initialize(dripper, action, options, &block) ⇒ Drip
constructor
A new instance of Drip.
-
#parameterized? ⇒ Boolean
If the associated ActionMailer uses ‘ActionMailer::Parameterized` initialization instead of argument-based initialization.
- #send_at ⇒ Object
Constructor Details
#initialize(dripper, action, options, &block) ⇒ Drip
Returns a new instance of Drip.
10 11 12 13 14 15 |
# File 'lib/caffeinate/drip.rb', line 10 def initialize(dripper, action, , &block) @dripper = dripper @action = action @options = @block = block end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
9 10 11 |
# File 'lib/caffeinate/drip.rb', line 9 def action @action end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
9 10 11 |
# File 'lib/caffeinate/drip.rb', line 9 def block @block end |
#dripper ⇒ Object (readonly)
Returns the value of attribute dripper.
9 10 11 |
# File 'lib/caffeinate/drip.rb', line 9 def dripper @dripper end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/caffeinate/drip.rb', line 9 def @options end |
Instance Method Details
#enabled?(mailing) ⇒ Boolean
Checks if the drip is enabled
27 28 29 |
# File 'lib/caffeinate/drip.rb', line 27 def enabled?(mailing) DripEvaluator.new(mailing).call(&@block) end |
#parameterized? ⇒ Boolean
If the associated ActionMailer uses ‘ActionMailer::Parameterized` initialization instead of argument-based initialization
18 19 20 |
# File 'lib/caffeinate/drip.rb', line 18 def parameterized? [:using] == :parameterized end |
#send_at ⇒ Object
22 23 24 |
# File 'lib/caffeinate/drip.rb', line 22 def send_at [:delay].from_now end |