Class: Sidekiq::Generators::WorkerGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/sidekiq/worker_generator.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_generator_rootObject



10
11
12
# File 'lib/generators/sidekiq/worker_generator.rb', line 10

def self.default_generator_root
  File.dirname(__FILE__)
end

Instance Method Details

#create_test_fileObject



18
19
20
21
22
23
24
# File 'lib/generators/sidekiq/worker_generator.rb', line 18

def create_test_file
  if defined?(RSpec)
    create_worker_spec
  else
    create_worker_test
  end
end

#create_worker_fileObject



14
15
16
# File 'lib/generators/sidekiq/worker_generator.rb', line 14

def create_worker_file
  template 'worker.rb.erb', File.join('app/workers', class_path, "#{file_name}_worker.rb")
end