Class: Angsa::JsGenerator

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

Instance Method Summary collapse

Instance Method Details

#angsa_api_urlObject



20
21
22
# File 'lib/generators/angsa/js_generator.rb', line 20

def angsa_api_url
  model_name
end

#generate_stimulus_controllerObject

main function to generate based on setup



8
9
10
11
12
13
# File 'lib/generators/angsa/js_generator.rb', line 8

def generate_stimulus_controller
  angsa_class = "#{model}Angsa".constantize.new(nil)
  @columns = angsa_class.columns.map { |col| col[:name].to_s.capitalize }

  template 'angsa_stimulus_controller.js', File.join('app', 'javascript', 'controllers', "#{stimulus_controller_path}.js")
end

#stimulus_controller_nameObject

make the class name



16
17
18
# File 'lib/generators/angsa/js_generator.rb', line 16

def stimulus_controller_name
  stimulus_controller_path.classify
end