Class: Caffeinate::PeriodicalDrip

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

Overview

A PeriodicalDrip object

Handles the block and provides convenience methods for the drip

Constant Summary collapse

VALID_DRIP_OPTIONS =
ALL_DRIP_OPTIONS + [:every, :until]

Constants inherited from Drip

Drip::ALL_DRIP_OPTIONS

Instance Attribute Summary

Attributes inherited from Drip

#action, #block, #dripper, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Drip

build, #enabled?, #initialize, #parameterized?, #send_at, #type

Constructor Details

This class inherits a constructor from Caffeinate::Drip

Class Method Details

.assert_options(options) ⇒ Object



18
19
20
# File 'lib/caffeinate/periodical_drip.rb', line 18

def assert_options(options)
  options.assert_valid_keys(*VALID_DRIP_OPTIONS)
end

.normalize_options(dripper, options) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/caffeinate/periodical_drip.rb', line 22

def normalize_options(dripper, options)
  options[:mailer_class] ||= options[:mailer] || dripper.defaults[:mailer_class]
  options[:using] ||= dripper.defaults[:using]
  options[:step] ||= dripper.drips.size + 1

  unless options.key?(:every)
    raise "Periodical drips must have an `every` option."
  end

  options
end

Instance Method Details

#everyObject



35
36
37
# File 'lib/caffeinate/periodical_drip.rb', line 35

def every
  options[:every]
end