Class: Hanami::CLI::Commands::Generate::Mailer Private

Inherits:
Command
  • Object
show all
Defined in:
lib/hanami/cli/commands/generate/mailer.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 1.1.0

Instance Method Summary collapse

Methods inherited from Command

inherited, #initialize

Constructor Details

This class inherits a constructor from Hanami::CLI::Commands::Command

Instance Method Details

#call(mailer:, **options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.1.0



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/hanami/cli/commands/generate/mailer.rb', line 27

def call(mailer:, **options)
  from    = clean_option(options.fetch(:from,    DEFAULT_FROM))
  to      = clean_option(options.fetch(:to,      DEFAULT_TO))
  subject = clean_option(options.fetch(:subject, DEFAULT_SUBJECT))
  context = Context.new(mailer: mailer, test: options.fetch(:test), from: from, to: to, subject: subject, options: options)

  generate_mailer(context)
  generate_mailer_spec(context)
  generate_text_template(context)
  generate_html_template(context)
end