Class: YARD::Handlers::RBS::NamespaceHandler

Inherits:
Base
  • Object
show all
Defined in:
lib/yard/handlers/rbs/namespace_handler.rb

Overview

Handles RBS class, module, and interface declarations by registering the corresponding namespace code objects and recursing into their bodies.

Constant Summary

Constants included from CodeObjects

CodeObjects::BUILTIN_ALL, CodeObjects::BUILTIN_CLASSES, CodeObjects::BUILTIN_EXCEPTIONS, CodeObjects::BUILTIN_EXCEPTIONS_HASH, CodeObjects::BUILTIN_MODULES, CodeObjects::CONSTANTMATCH, CodeObjects::CONSTANTSTART, CodeObjects::CSEP, CodeObjects::CSEPQ, CodeObjects::ISEP, CodeObjects::ISEPQ, CodeObjects::METHODMATCH, CodeObjects::METHODNAMEMATCH, CodeObjects::NAMESPACEMATCH, CodeObjects::NSEP, CodeObjects::NSEPQ

Instance Method Summary collapse

Methods included from CodeObjects::NamespaceMapper

#clear_separators, #default_separator, on_invalidate, #register_separator, #separators, #separators_for_type, #separators_match, #types_for_separator, #unregister_separator_by_type

Constructor Details

This class inherits a constructor from YARD::Handlers::Base

Instance Method Details

#processvoid

This method returns an undefined value.

Main processing callback



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/yard/handlers/rbs/namespace_handler.rb', line 8

process do
  name = statement.name
  type = statement.type

  obj = case type
        when :class
          klass = register ClassObject.new(namespace, name)
          if (sc = statement.superclass) && !sc.strip.empty?
            klass.superclass = P(namespace, sc)
            klass.superclass.type = :class if klass.superclass.is_a?(Proxy)
          end
          klass
        when :module, :interface
          register ModuleObject.new(namespace, name)
        end

  parse_block(:namespace => obj)
end