Sha256: 84a2ec20237c7a3c3e8e9529e4bdc67a7a704694c30223df7a6a58d18c9af8c6
Contents?: true
Size: 1.2 KB
Versions: 133
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true # :nocov: module Primer module Yard # :nodoc: class ComponentRef ATTR_DEFAULTS = { js: false, examples: true, published: 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 published? @attrs.fetch(:published, ATTR_DEFAULTS[:published]) 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://primer.style/view-components/lookbook/inspect/#{path}/default/" end end end end end # :nocov:
Version data entries
133 entries across 133 versions & 2 rubygems