Method: YARD::Templates::Helpers::HtmlHelper#format_types
- Defined in:
- lib/yard/templates/helpers/html_helper.rb
permalink #format_types(typelist, brackets = true) ⇒ String
Formats a list of types from a tag.
372 373 374 375 376 377 378 379 380 |
# File 'lib/yard/templates/helpers/html_helper.rb', line 372 def format_types(typelist, brackets = true) return unless typelist.is_a?(Array) list = typelist.map do |type| type = type.gsub(/([<>])/) { h($1) } type = type.gsub(/([\w:]+)/) { $1 == "lt" || $1 == "gt" ? $1 : linkify($1, $1) } "<tt>" + type + "</tt>" end list.empty? ? "" : (brackets ? "(#{list.join(", ")})" : list.join(", ")) end |