class ViewComponent::Preview
def preview_example_template_path(example)
def preview_example_template_path(example) preview_path = Array(preview_paths).detect do |path| Dir["#{path}/#{preview_name}_preview/#{example}.html.*"].first end raise MissingPreviewTemplateError.new(example) if preview_path.nil? path = Dir["#{preview_path}/#{preview_name}_preview/#{example}.html.*"].first Pathname.new(path) .relative_path_from(Pathname.new(preview_path)) .to_s .sub(/\..*$/, "") end