Closed ghost closed 2 years ago
This is a great start, but there are still a couple of use cases that don't match YARD's specification.
A @!visibility
directive that is attached to a method should not modify other methods. Example spec:
it "processes private visibility directives attached to methods" do
map = Solargraph::SourceMap.load_string(%(
class Example
# @!visibility private
def method1; end
def method2; end
end
))
method1 = map.first_pin('Example#method1')
expect(method1.visibility).to be(:private)
method2 = map.first_pin('Example#method2')
expect(method2.visibility).to be(:public)
end
A @!visibility
directive that is not attached to a method should modify other methods and can be overridden. Example spec:
it "processes class-wide private visibility directives" do
map = Solargraph::SourceMap.load_string(%(
class Example
# @!visibility private
def method1; end
def method2; end
# @!visibility public
def method3; end
end
))
method1 = map.first_pin('Example#method1')
expect(method1.visibility).to be(:private)
method2 = map.first_pin('Example#method2')
expect(method2.visibility).to be(:private)
method3 = map.first_pin('Example#method3')
expect(method3.visibility).to be(:public)
end
I'll go ahead and merge this and make the changes to pass the two additional specs. It'll be released in 0.47.0.
Implement handling of the yard @!visibility directive.
Should address #566.
Signed-off-by: liberatys nick.anthony.flueckiger@hey.com