Alex's Slip-box

These are my org-mode notes in sort of Zettelkasten style

yard docs

I can never remember yard doc syntax.

👀 Here’s a nice cheatsheet: https://github.com/chriscz/cheatsheets/blob/main/yard/index.md 👀

quick example:

# A method that does stuff and things +this will be rendered inside <code> tag+
# @param bar [String] description of param
# @param baz [Int] description of param
# @yield [bar] description of block
# @raise [ArgumentError] description of the error
# @return [Symbol, nil]
def foo(bar:, baz: 0)
  # Do stuff and things
  raise ArgumentError if baz.negative?
  yield bar
  return :foo if baz.zero?
end
  • yard handles default params automatically, no need to specify this in the description
  • running yardoc will write documentation files to ./doc by default

Search Results