### Home Classes Methods

### In Files

- lib/padrino-gen/generators/mailer.rb

### Parent

Thor::Group

### Methods

- ::banner
- ::source_root
- #create_mailer

### Included Modules

- Thor::Actions
- Padrino::Generators::Actions
- Padrino::Generators::Components::Actions

### Files

- README.rdoc
- README.rdoc

### Class/Module Index

Quicksearch

- Padrino
- Padrino::Generators
- Padrino::Generators::Actions
- Padrino::Generators::Actions::ClassMethods
- Padrino::Generators::App
- Padrino::Generators::AppRootNotFound
- Padrino::Generators::Cli
- Padrino::Generators::Component
- Padrino::Generators::Components
- Padrino::Generators::Components::Actions
- Padrino::Generators::Controller
- Padrino::Generators::Mailer
- Padrino::Generators::Migration
- Padrino::Generators::Model
- Padrino::Generators::Plugin
- Padrino::Generators::Project
- Padrino::Generators::Runner
- Padrino::Generators::SqlHelpers
- Padrino::Generators::Task
- ActiveRecord
- ActiveRecord::Schema
- Object

No matching classes.

# Padrino::Generators::Mailer

Responsible for the generating mailers and message definitions.

### Public Class Methods

banner() click to toggle source

    # File lib/padrino-gen/generators/mailer.rb, line 11
    def self.banner; 'padrino-gen mailer [name]'; end

source_root() click to toggle source

    # File lib/padrino-gen/generators/mailer.rb, line 10
    def self.source_root; File.expand_path(File.dirname(__FILE__)); end

### Public Instance Methods

create_mailer() click to toggle source

Execute mailer generation.

    # File lib/padrino-gen/generators/mailer.rb, line 32
    def create_mailer
      self.destination_root = options[:root]
      if in_app_root?
        app = options[:app]
        check_app_existence(app)
        self.behavior    = :revoke if options[:destroy]
        @project_name    = options[:namespace].underscore.camelize
        @project_name    = fetch_project_name(app) if @project_name.empty?
        @app_name        = fetch_app_name(app)
        @actions         = actions.map(&:to_sym)
        @short_name      = name.to_s.gsub(/_mailer/, '').underscore.downcase
        @mailer_basename = @short_name.underscore
        template "templates/mailer.rb.tt", destination_root(app, 'mailers', "#{@mailer_basename}.rb")
        empty_directory destination_root(app, 'views', 'mailers', @mailer_basename)
      else
        say 'You are not at the root of a Padrino application! (config/boot.rb not found)'
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.