-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
How can I check loaded version of XDG module? #4
Comments
Hey, Hubert, nice to meet you. 👋 I've been subscribed to your PostgreSQL articles for some time. If you are asking how to quickly determine which version of XDG supports which version of Ruby, that can be done several ways:
Does that help? |
Hmnmm .. I have 2.2.5, and when I tried XDG::Config.new:
So it looks that with 2.2.5 I don't have XDG::Config, and I don't have XDG::Identity :( |
As a side note:
No idea what that means. |
Ah, apologies. I see the problem now. I miss quoted you earlier. You must be on 3.0.0 or higher to leverage In your case, I think you'd have everything you need by doing something close to the following: defined?(XDG::Config) ? "Using 3.0.0 or higher" : "Using 2.2.5 or lower" That should allow you to feature toggle your code as desired. |
That works. Thanks a lot. |
Overview
I have varying version of xdg loaded in many places - in one it's 2.2.5, in another it's 4.5.0. All depending on ruby version, I guess.
The problem is that they have very different APIs.
I can work around it, by adding version check, but I'd need to know how to find version of used XDG library.
Or, perhaps, how else should I know whether I can use, very convenient XDG['CONFIG'].find(), and where I have to iterate over XDG::Config.new.directories and check for file existence...
The text was updated successfully, but these errors were encountered: