Yard, attr_reader and setters

Hi,

I have a problem with documenting with yard. See this small example:

This is an example class

class MyClass
def initialize
@foo = 0
@bla = 1
end
attr_reader :foo

# @param [Integer] f sets the value of foo.
def foo=(f)
    @foo = f
end

# @param [Integer] b sets the value of bla.
def bla=(b)
    @bla = b
end

end

When I start yard on this class, the method bla is documented like
expected, but the method foo is left out. If I remove the attr_reader of
@foo the foo method gets also documented. How can I get around this
without to rename my methods to i.e. foo_set or such?

Thanks, detlef

This use case is already described at
#setter= documentation is hidden if used with attr_accessor or attr_reader · Issue #516 · lsegal/yard · GitHub . You’ll find the comment of
the yard maintainer there.

If you are not going to put any code into the manually defined setters
and you can keep them public, then you could write your code like this:

class MyClass
# @return [Integer] Set the foo to a number
attr_accessor :foo

# @return [Integer] Set the bla to a number
attr_accessor :bla

def initialize
    self.foo = 0
    self.bla = 1
end

end