module ViewComponent::AbstractGenerator
Public Instance Methods
copy_view_file()
click to toggle source
# File lib/rails/generators/abstract_generator.rb, line 5 def copy_view_file unless options["inline"] template "component.html.#{engine_name}", destination end end
Private Instance Methods
component_path()
click to toggle source
# File lib/rails/generators/abstract_generator.rb, line 33 def component_path ViewComponent::Base.view_component_path end
destination()
click to toggle source
# File lib/rails/generators/abstract_generator.rb, line 13 def destination File.join(destination_directory, "#{destination_file_name}.html.#{engine_name}") end
destination_directory()
click to toggle source
# File lib/rails/generators/abstract_generator.rb, line 17 def destination_directory if options["sidecar"] File.join(component_path, class_path, destination_file_name) else File.join(component_path, class_path) end end
destination_file_name()
click to toggle source
# File lib/rails/generators/abstract_generator.rb, line 25 def destination_file_name "#{file_name}_component" end
file_name()
click to toggle source
Calls superclass method
# File lib/rails/generators/abstract_generator.rb, line 29 def file_name @_file_name ||= super.sub(/_component\z/i, "") end
stimulus_controller()
click to toggle source
# File lib/rails/generators/abstract_generator.rb, line 37 def stimulus_controller if options["stimulus"] File.join(destination_directory, destination_file_name). sub("#{component_path}/", ""). gsub("_", "-"). gsub("/", "--") end end