Minor YARD improvements

This commit is contained in:
Douglas Eichelberger 2023-04-05 10:06:45 -07:00
parent 61efc7076d
commit 200b5cad6a
4 changed files with 13 additions and 9 deletions

View File

@ -64,4 +64,4 @@ jobs:
- name: Process rubydoc comments - name: Process rubydoc comments
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/Library/Homebrew working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/Library/Homebrew
run: bundle exec yard doc --plugin sorbet --no-output --fail-on-warning run: bundle exec yard doc --no-output --fail-on-warning

View File

@ -2,6 +2,7 @@
--main README.md --main README.md
--markup markdown --markup markdown
--no-private --no-private
--plugin sorbet
--load yard/ignore_directives.rb --load yard/ignore_directives.rb
--template-path yard/templates --template-path yard/templates
--exclude test/ --exclude test/

View File

@ -29,14 +29,13 @@ module Utils
# defined by the formula, as only `HOMEBREW_PREFIX` is available # defined by the formula, as only `HOMEBREW_PREFIX` is available
# in the {DATAPatch embedded patch}. # in the {DATAPatch embedded patch}.
# #
# `inreplace` supports regular expressions: # @example `inreplace` supports regular expressions:
# <pre>inreplace "somefile.cfg", /look[for]what?/, "replace by #{bin}/tool"</pre> # inreplace "somefile.cfg", /look[for]what?/, "replace by #{bin}/tool"
# #
# `inreplace` supports blocks: # @example `inreplace` supports blocks:
# <pre>inreplace "Makefile" do |s| # inreplace "Makefile" do |s|
# s.gsub! "/usr/local", HOMEBREW_PREFIX.to_s # s.gsub! "/usr/local", HOMEBREW_PREFIX.to_s
# end # end
# </pre>
# #
# @see StringInreplaceExtension # @see StringInreplaceExtension
# @api public # @api public

View File

@ -1,7 +1,10 @@
# typed: false # typed: true
# frozen_string_literal: true # frozen_string_literal: true
def init def init
# `sorbet` is available transitively through the `yard-sorbet` plugin, but we're
# outside of the standalone sorbet config, so `checked` is enabled by default
T.bind(self, YARD::Templates::Template, checked: false)
super super
return if sections.empty? return if sections.empty?
@ -10,5 +13,6 @@ def init
end end
def internal def internal
T.bind(self, YARD::Templates::Template, checked: false)
erb(:internal) if object.has_tag?(:api) && object.tag(:api).text == "internal" erb(:internal) if object.has_tag?(:api) && object.tag(:api).text == "internal"
end end