YARD - how to document @!method YARD on class level rather than instance level?

Viewed 23
2 Answers

This can be adjusted via @!scope which can be either class or instance:

class Foo
  # @!scope class
  #
  # @!method bar
  #   @return [Bar] enum scope
  # @!method baz
  #   @return [Baz] enum scope
end

See Documenting Custom DSL Methods

Workaround using blank eigen-class seems to work fine but perhaps someone knows a more idiomatic and clean way of doing it?

class Foo < ActiveRecord::Base
  class << self
    # @!method bar
    #   @return [Bar] enum scope
    # @!method baz
    #   @return [Baz] enum scope
  end
  enum status: FooStatuses
end
Related