Method: Jazzy::SourceKitten.expand_extensions
- Defined in:
- lib/jazzy/sourcekitten.rb
.expand_extensions(decls) ⇒ Object
Expands extensions of nested types declared at the top level into a tree so they can be deduplicated properly
647 648 649 650 651 652 653 654 655 656 657 658 659 |
# File 'lib/jazzy/sourcekitten.rb', line 647 def self.(decls) decls.map do |decl| next decl unless decl.type.extension? && decl.name.include?('.') # Don't expand the Swift namespace if we're in ObjC mode. # ex: NS_SWIFT_NAME(Foo.Bar) should not create top-level Foo next decl if decl.swift_objc_extension? && !Config.instance.hide_objc? name_parts = decl.name.split('.') decl.name = name_parts.pop (decl, name_parts, decls) end end |