Class: Caffeinate::Generators::MailerGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Caffeinate::Generators::MailerGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/caffeinate/mailer_generator.rb
Overview
Creates a mailer from a dripper.
Instance Method Summary collapse
Instance Method Details
#create_mailer ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/generators/caffeinate/mailer_generator.rb', line 13 def create_mailer @dripper_klass = @dripper.safe_constantize if @dripper_klass.nil? raise ArgumentError, "Unknown dripper #{@dripper}" end @mailer_class = @dripper_klass.defaults[:mailer_class] || @dripper_klass.defaults[:mailer] template 'mailer.rb', "app/mailers/#{@mailer_class.underscore}.rb" end |