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

Removed singleton dependency #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Removed singleton dependency #129

wants to merge 1 commit into from

Conversation

hsbt
Copy link
Member

@hsbt hsbt commented Jan 31, 2024

I have a plan to extract singleton library as bundled gems at Ruby 3.5. We should rewrite singleton logic with simple ruby code.

  I have a plan to extract singleton library as bundled gems at Ruby 3.5.
  We should rewrite singleton logic with simple ruby code.
Copy link
Contributor

@jeremyevans jeremyevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK with this. I think it would be better to initialize the instance up front, and store it in a class instance variable. You could even make instance a singleton class attr_reader.

@@ -142,6 +139,11 @@ def self.terminate
instance.terminate
end

def self.instance
@instance ||= new
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this thread safe? (and/or is that a problem here?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants