Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a better way to redefine the ::Trilogy constant? #2

Open
a-lavis opened this issue Sep 4, 2023 · 0 comments
Open

Is there a better way to redefine the ::Trilogy constant? #2

a-lavis opened this issue Sep 4, 2023 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@a-lavis
Copy link
Owner

a-lavis commented Sep 4, 2023

When loading the TrilogyAurora module, the following warnings appear:

> bin/rails console
/Users/aidanlavis/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/trilogy_aurora-0.1.0/lib/trilogy_aurora.rb:105: warning: already initialized constant Trilogy
/Users/aidanlavis/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/trilogy-2.5.0/lib/trilogy/version.rb:1: warning: previous definition of Trilogy was here

This is clearly caused by this code:

# Swap out the original ::Trilogy class with our wrapper (Trilogy).
::Trilogy = TrilogyAurora::Trilogy

We are redefining ::Trilogy to a different class, namely TrilogyAurora::Trilogy.

Is there a better way of doing this that doesn't trigger these warnings?

Alternatively, should we be extending the functionality of the Trilogy class in a completely different way?

@a-lavis a-lavis changed the title Is there a better way to redefine a constant? Is there a better way to redefine the ::Trilogy constant? Sep 4, 2023
@a-lavis a-lavis added the help wanted Extra attention is needed label Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant