Class: Rails::Generators::JobGenerator

Inherits:
NamedBase show all
Defined in:
activejob/lib/rails/generators/job/job_generator.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NamedBase

#initialize

Methods inherited from Base

base_root, class_option, default_source_root, desc, hide!, hook_for, inherited, namespace, remove_hook_for, source_root

Methods included from Actions

#add_source, #after_bundle, #capify!, #environment, #gem, #gem_group, #generate, #git, #initialize, #initializer, #lib, #rails_command, #rake, #rakefile, #readme, #route, #vendor

Constructor Details

This class inherits a constructor from Rails::Generators::NamedBase

Class Method Details

.default_generator_rootObject


14
15
16
# File 'activejob/lib/rails/generators/job/job_generator.rb', line 14

def self.default_generator_root
  File.dirname(__FILE__)
end

Instance Method Details

#create_job_fileObject


18
19
20
21
22
23
24
25
26
# File 'activejob/lib/rails/generators/job/job_generator.rb', line 18

def create_job_file
  template 'job.rb', File.join('app/jobs', class_path, "#{file_name}_job.rb")

  in_root do
    if self.behavior == :invoke && !File.exist?(application_job_file_name)
      template 'application_job.rb', application_job_file_name
    end
  end
end