Is your feature request related to a problem? Please describe.
When using #delegate, ActiveSupport creates a new method on the class, but this method does not respect the visibility scope of said class.
For example:
class Foo
def initialize(bar)
@bar = bar
end
attr_reader :bar
private
delegate :baz, to: :bar
end
The generated method #baz will not be private. The #delegate method does, however, provide an option to create a private method like so:
delegate :baz, to: :bar, private: true
Describe the solution you'd like
I would like a cop that detects calls to #delegate that:
- Are in a
private scope.
- Does not pass the
private: true option.
Is your feature request related to a problem? Please describe.
When using
#delegate, ActiveSupport creates a new method on the class, but this method does not respect the visibility scope of said class.For example:
The generated method
#bazwill not be private. The#delegatemethod does, however, provide an option to create a private method like so:Describe the solution you'd like
I would like a cop that detects calls to
#delegatethat:privatescope.private: trueoption.