Class: CrossbeamGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/crossbeam_generator.rb

Overview

Used to generate a Rails service object

Instance Method Summary collapse

Instance Method Details

#generate_servicevoid

This method returns an undefined value.



17
18
19
# File 'lib/generators/crossbeam_generator.rb', line 17

def generate_service
  template 'service_class.rb.tt', "app/#{class_directory}/#{filename}.rb", force: true
end

#generate_testvoid

This method returns an undefined value.



22
23
24
25
26
# File 'lib/generators/crossbeam_generator.rb', line 22

def generate_test
  return unless Rails.application&.config&.generators&.test_framework == :rspec

  template 'service_spec.rb.tt', "spec/#{class_directory}/#{filename}_spec.rb", force: true
end