Sha256: 926b3c137a34c6b42f69bdd2e91063772917a4dac9b620b4c5703e05c26c2476

Contents?: true

Size: 777 Bytes

Versions: 7

Compression:

Stored size: 777 Bytes

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
    end
  end
end
# :nocov:

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
primer_view_components-0.1.4 lib/primer/yard/component_ref.rb
primer_view_components-0.1.3 lib/primer/yard/component_ref.rb
primer_view_components-0.1.2 lib/primer/yard/component_ref.rb
primer_view_components-0.1.1 lib/primer/yard/component_ref.rb
primer_view_components-0.1.0 lib/primer/yard/component_ref.rb
primer_view_components-0.0.123 lib/primer/yard/component_ref.rb
primer_view_components-0.0.122 lib/primer/yard/component_ref.rb