Module: Caffeinate::Dripper::Inferences::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#inferred_campaign_slugObject

The inferred campaign slug

MyCoolDripper => my_cool


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

def inferred_campaign_slug
  name.delete_suffix('Dripper').to_s.underscore
end

#inferred_mailer_classObject

The inferred mailer class



13
14
15
16
17
18
19
20
# File 'lib/caffeinate/dripper/inferences.rb', line 13

def inferred_mailer_class
  klass_name = "#{name.delete_suffix('Dripper')}Mailer"
  klass = klass_name.safe_constantize
  return nil unless klass
  return klass_name if klass < ::ActionMailer::Base

  nil
end