Class: YARDSorbet::Handlers::IncludeHandler

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

Overview

Extends any modules included via mixes_in_class_methods

Instance Method Summary collapse

Instance Method Details

#included_inYARD::CodeObjects::NamespaceObject (private)

Returns the namespace object that is including the module.

Returns:

  • (YARD::CodeObjects::NamespaceObject)

    the namespace object that is including the module



28
29
30
# File 'lib/yard-sorbet/handlers/include_handler.rb', line 28

def included_in
  statement.namespace ? YARD::CodeObjects::Proxy.new(namespace, statement.namespace.source) : namespace
end

#processvoid

This method returns an undefined value.



16
17
18
19
20
21
22
# File 'lib/yard-sorbet/handlers/include_handler.rb', line 16

def process
  statement.parameters(false).each do |mixin|
    obj = YARD::CodeObjects::Proxy.new(namespace, mixin.source)
    class_methods_namespaces = MixesInClassMethodsHandler.mixed_in_class_methods(obj.to_s)
    class_methods_namespaces&.each { included_in.mixins(:class) << YARD::CodeObjects::Proxy.new(obj, _1) }
  end
end