Class: YARDSorbet::Handlers::AbstractDSLHandler

Inherits:
YARD::Handlers::Ruby::Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/yard-sorbet/handlers/abstract_dsl_handler.rb

Overview

Applies an @abstract tag to abstract!/interface! modules (if not alerady present).

Constant Summary collapse

TAG_TEXT =

The text accompanying the @abstract tag.

'Subclasses must implement the `abstract` methods below.'
CLASS_TAG_TEXT =

Extra text for class namespaces

T.let("It cannot be directly instantiated. #{TAG_TEXT}".freeze, String)

Instance Method Summary collapse

Instance Method Details

#processvoid

This method returns an undefined value.



21
22
23
24
25
26
27
# File 'lib/yard-sorbet/handlers/abstract_dsl_handler.rb', line 21

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