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



30
31
32
# File 'lib/yard-sorbet/handlers/include_handler.rb', line 30

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
23
24
# 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_namespace = MixesInClassMethodsHandler.mixed_in_class_methods(obj.to_s)
    next unless class_methods_namespace

    included_in.mixins(:class) << YARD::CodeObjects::Proxy.new(obj, class_methods_namespace)
  end
end