Conversation
There was a problem hiding this comment.
The rename is implemented cleanly and includes backward compatibility, but the aliasing approach in lib/vestauth.rb could be made more explicit/maintainable (and ideally deprecate provider if the intent is migration). One spec description is slightly inconsistent with the new naming and could be clarified to keep tests serving as accurate documentation.
Summary of changes
What changed
- Updated the README usage example to call
Vestauth.tool.verify(...)instead ofVestauth.provider.verify(...). - In
lib/vestauth.rb, renamed the public accessor fromself.providertoself.tool(returningProvider). - Added a backward-compatible alias so
Vestauth.providercontinues to work viaalias provider tool. - Updated specs to:
- Assert
Vestauth.toolreturnsVestauth::Provider. - Use
Vestauth.tool.verify(...)in verification-related examples.
- Assert
Relevant files:
README.mdlib/vestauth.rbspec/vestauth_spec.rb
| def self.tool | ||
| Provider | ||
| end | ||
|
|
||
| class << self | ||
| alias provider tool | ||
| end | ||
|
|
There was a problem hiding this comment.
The alias provider tool keeps backward compatibility, but the current placement (class << self block separated from the def self.tool) is a bit indirect and can be confusing to maintain. Since this is a module with singleton methods, you can define the alias directly on the singleton class in a tighter, more idiomatic way, and ideally add a short deprecation note so callers know to migrate.
Also, if this is intended as a rename rather than a permanent dual API, consider emitting a deprecation warning from provider to drive adoption (while keeping it non-breaking).
Suggestion
Consider restructuring to make the relationship explicit and optionally deprecate the old name:
module Vestauth
def self.tool
Provider
end
class << self
def provider
warn "Vestauth.provider is deprecated; use Vestauth.tool" if $VERBOSE
tool
end
end
endThis keeps compatibility while encouraging migration. Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this suggestion.
No description provided.