class Rails::Generators::StimulusGenerator

Public Instance Methods

copy_controller_file() click to toggle source
# File lib/generators/rails/stimulus_generator.rb, line 13
def copy_controller_file
  actions.each do |action|
    @action = action
    template('controller.js', controller_path + "#{action}_controller.js")
  end
end
copy_stylesheet_file() click to toggle source
# File lib/generators/rails/stimulus_generator.rb, line 20
def copy_stylesheet_file
  template('controller.scss', stylesheet_path + "#{file_name.pluralize}.scss")
end
create_controller_dir() click to toggle source
# File lib/generators/rails/stimulus_generator.rb, line 9
def create_controller_dir
  empty_directory(controller_path) unless File.directory?(controller_path)
end

Private Instance Methods

controller_path() click to toggle source
# File lib/generators/rails/stimulus_generator.rb, line 30
def controller_path
  source_path + "javascripts/controllers/#{file_name.pluralize}"
end
source_path() click to toggle source
# File lib/generators/rails/stimulus_generator.rb, line 26
def source_path
  ::Webpacker.instance.config.source_path
end
stylesheet_path() click to toggle source
# File lib/generators/rails/stimulus_generator.rb, line 34
def stylesheet_path
  source_path + 'stylesheets'
end