这是indexloc提供的服务,不要输入任何密码
Skip to content

Use File.exist? for 3.2.0 compatibility #12

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

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

ishiikurisu
Copy link
Contributor

Ever since updating some projects to Ruby 3.2.0, this library was broken. The fix was to include a snippet like the following in the code:

unless File.respond_to?(:exists?)
  class << File
    alias_method :exists?, :exist?
  end
end

This PR includes a version of this fix to this library which should be compatible with versions both before and after 3.2.0.

@ishiikurisu
Copy link
Contributor Author

I'm unaware of other features broken because of this update, so maybe it is relevant to check for other changes?

@ishiikurisu ishiikurisu changed the title Use File.exists? for 3.2.0 compatibility Use File.exist? for 3.2.0 compatibility Jun 28, 2024
@geraldb
Copy link
Member

geraldb commented Jun 28, 2024

thanks for highlighting the breaking change with File.exists? - note - might be better to simply rename File.exists? to File.exist?, no?

@ishiikurisu
Copy link
Contributor Author

Checked the documentation and using just File.exist? seems to be safe so I updated the PR accordingly. Good call!

@geraldb
Copy link
Member

geraldb commented Jun 28, 2024

thks. let's give it a try. i try to push a new gem with your changes.

@geraldb geraldb merged commit 3fd66eb into rubycocos:master Jun 28, 2024
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.

2 participants