class ViewComponent::Config
def default_generate_options
def default_generate_options options = ActiveSupport::OrderedOptions.new(false) options.preview_path = "" options end
def default_preview_paths
def default_preview_paths return [] unless defined?(Rails.root) && Dir.exist?("#{Rails.root}/test/components/previews") ["#{Rails.root}/test/components/previews"] end
def defaults
def defaults ActiveSupport::OrderedOptions.new.merge!({ generate: default_generate_options, preview_controller: "ViewComponentsController", preview_route: "/rails/view_components", show_previews_source: false, instrumentation_enabled: false, use_deprecated_instrumentation_name: true, render_monkey_patch_enabled: true, view_component_path: "app/components", component_parent_class: nil, show_previews: Rails.env.development? || Rails.env.test?, preview_paths: default_preview_paths, test_controller: "ApplicationController", default_preview_layout: nil, capture_compatibility_patch_enabled: false }) end
def initialize
def initialize @config = self.class.defaults end