Method: Jazzy::SourceKitten.merge_code_declaration
- Defined in:
- lib/jazzy/sourcekitten.rb
.merge_code_declaration(decls) ⇒ Object
Merge useful information added by extensions into the main declaration: public protocol conformances and, for top-level extensions, further conditional extensions of the same type.
910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 |
# File 'lib/jazzy/sourcekitten.rb', line 910 def self.merge_code_declaration(decls) declarations = decls[1..].select do |decl| decl.type.swift_extension? && (decl.other_inherited_types?(@inaccessible_protocols) || (decls.first.type.swift_extension? && decl.constrained_extension?)) end.prepend(decls.first) html_declaration = '' until declarations.empty? module_decls, declarations = next_doc_module_group(declarations) first = module_decls.first if need_doc_module_note?(first, html_declaration) html_declaration += "<span class='declaration-note'>From #{first.doc_module_name}:</span>" end html_declaration += module_decls.map(&:declaration).uniq.join end # Must preserve `nil` for edge cases decls.first.declaration = html_declaration unless html_declaration.empty? end |