Open mattheworiordan opened 4 years ago
@mattheworiordan could you please clarify what's needed to be done here? Do you want to make private methods marked with@api private
?
See https://github.com/ably/ably-ruby/blob/main/lib/ably/rest/client.rb#L81-L89 for example. These are actually public methods, but only flagged as @private
so from a docs perspective they are private. They should instead be protected
so that those attributes are not publicly accessible. You may find as you try and change the @private
attributes/methods to protected
tests may break. You will have to go as far as possible to make as many methods as possible protected
and then revisit the ones you could not do to see if this is work worth doing, or accepting some imperfection.
@mattheworiordan thanks for the reply. protected
makes a method to be accessible inside/by instances of the same class, used for example in (#<=>
). So it doesn't really make sense to use it here. Unfortunately, unlike other languages, ruby doesn't have any package/module level visibility modifier. However, I can make a handful of methods/attributes private
, but wanted to confirm that we want to proceed in that direction
Protected methods are used sparingly, with instead private APIs that need to be public exposed as annotated
@private
methods (which only affects docs) - see https://github.com/ably/ably-ruby/blob/master/lib/ably/rest/client.rb#L92-L95.There were reasons at the outset why
protected
was not used, which I cannot recall. Perhaps backwards compatibility with older versions of Ruby, something I doubt is needed now.┆Issue is synchronized with this Jira Story by Unito