Sha256: 20e73fdaf3649fb0b14988732851adbe08431b0fa23797bd78015079275c0168
Contents?: true
Size: 1.09 KB
Versions: 46
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true # :nocov: module Ariadne module Yard # :nodoc: class ComponentRef ATTR_DEFAULTS = { js: false, examples: true, form_component: false, }.freeze attr_reader :klass, :attrs def initialize(klass, attrs) @klass = klass @attrs = attrs end def requires_js? @attrs.fetch(:js, ATTR_DEFAULTS[:js]) end def should_have_examples? @attrs.fetch(:examples, ATTR_DEFAULTS[:examples]) end def form_component? @attrs.fetch(:form_component, ATTR_DEFAULTS[:form_component]) end def source_url @source_url ||= begin path = klass.name.split("::").map(&:underscore).join("/") "https://github.com/primer/view_components/tree/main/app/components/#{path}.rb" end end def lookbook_url @lookbook_url ||= begin path = klass.name.underscore.gsub("_component", "") "https://ariadne.style/view-components/lookbook/inspect/#{path}/default/" end end end end end # :nocov:
Version data entries
46 entries across 46 versions & 1 rubygems