Class: ShouldaMatchmakers::ModelMatcherGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Generator::ActiveRecord::ModelMatcherGeneratorHelper
Defined in:
lib/generators/shoulda_matchmakers/model_matcher_generator.rb

Instance Method Summary collapse

Methods included from Generator::ActiveRecord::ModelMatcherGeneratorHelper

#filter_active_record_class_names_with_config_options, #filter_active_record_class_names_with_exclude_option, #filter_active_record_class_names_with_generator_exclude_and_config_options, #filter_active_record_class_names_with_generator_include_and_config_options, #filter_active_record_class_names_with_include_option, #filter_app_active_record_descendants_names, #get_app_active_record_descendants_names, #load_application, #save_generate

Instance Method Details

#create_model_matchmakersObject



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/generators/shoulda_matchmakers/model_matcher_generator.rb', line 53

def create_model_matchmakers
  puts "\n"
  generator = "model"
  generator_options = options.to_hash
  working_generated_code_line_length = ::ShouldaMatchmakers.configuration.preferred_generated_code_line_length - 6
  SpinToWin.with_spinner('ShouldaMatchmakers:ModelMatchers') do |spinner|
    spinner.banner('initializing...')
    load_application
    @app_active_record_descendants_names = get_app_active_record_descendants_names
  end
  puts "\n"
  generate_active_record_model_matchmakers(generator, generator_options, @app_active_record_descendants_names, working_generated_code_line_length)
end