Skip to content

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants