Module: Caffeinate::Dripper::Drip::ClassMethods

Defined in:
lib/caffeinate/dripper/drip.rb

Instance Method Summary collapse

Instance Method Details

#drip(action_name, options = {}, &block) ⇒ Object

Register a drip on the Dripper

drip :mailer_action_name, mailer_class: "MailerClass", step: 1, delay: 1.hour

Parameters:

  • action_name (Symbol)

    the name of the mailer action

  • options (Hash) (defaults to: {})

    the options to create a drip with

Options Hash (options):

  • :mailer_class (String)

    The mailer_class

  • :step (Integer)

    The order in which the drip is executed

  • :delay (ActiveSupport::Duration)

    When the drip should be ran

  • :using (Symbol)

    set to :parameters if the mailer action uses ActionMailer::Parameters



34
35
36
# File 'lib/caffeinate/dripper/drip.rb', line 34

def drip(action_name, options = {}, &block)
  drip_collection.register(action_name, options, &block)
end

#drip_collectionObject

A collection of Drip objects associated with a given Caffeinate::Dripper



15
16
17
# File 'lib/caffeinate/dripper/drip.rb', line 15

def drip_collection
  @drip_collection ||= DripCollection.new(self)
end

#dripsObject

A collection of Drip objects associated with a given Caffeinate::Dripper



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

def drips
  drip_collection.values
end