Sha256: afe56bb95fba2f7f9b606033d2207183a5969e6e4ee2068272fbf5cd56a40991
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
# typed: strict # frozen_string_literal: true module YARDSorbet module Handlers # Applies an `@abstract` tag to `abstract!`/`interface!` modules (if not alerady present). class AbstractDSLHandler < YARD::Handlers::Ruby::Base extend T::Sig handles method_call(:abstract!), method_call(:interface!) namespace_only # The text accompanying the `@abstract` tag. # @see https://github.com/lsegal/yard/blob/main/templates/default/docstring/html/abstract.erb # The `@abstract` tag template TAG_TEXT = 'Subclasses must implement the `abstract` methods below.' # Extra text for class namespaces CLASS_TAG_TEXT = T.let("It cannot be directly instantiated. #{TAG_TEXT}".freeze, String) sig { void } def process return if namespace.has_tag?(:abstract) text = namespace.is_a?(YARD::CodeObjects::ClassObject) ? CLASS_TAG_TEXT : TAG_TEXT tag = YARD::Tags::Tag.new(:abstract, text) namespace.add_tag(tag) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yard-sorbet-0.9.0 | lib/yard-sorbet/handlers/abstract_dsl_handler.rb |