class ViewComponent::Generators::ComponentGenerator
def create_component_file
def create_component_file template "component.rb", File.join(component_path, class_path, "#{file_name}#{"_component" unless options[:skip_suffix]}.rb") end
def default_parent_class
def default_parent_class defined?(ApplicationComponent) ? ApplicationComponent : ViewComponent::Base end
def initialize_body
def initialize_body attributes.map { |attr| "@#{attr.name} = #{attr.name}" }.join("\n ") end
def initialize_call_method_for_inline?
def initialize_call_method_for_inline? options["call"] end
def initialize_signature
def initialize_signature return if attributes.blank? attributes.map { |attr| "#{attr.name}:" }.join(", ") end
def initialize_signature?
def initialize_signature? initialize_signature.present? end
def inline_template?
def inline_template? options["inline"] end
def parent_class
def parent_class return options[:parent] if options[:parent] ViewComponent::Base.config.generate.parent_class || default_parent_class end
def template_engine
def template_engine options["template_engine"] end