After upgrading to Ruby 3.2, we had the following error pop up in Sentry:
NoMethodError: undefinedmethod`exists?' for File:Class (NoMethodError) File.delete(ssl_filename) if File.exists?(ssl_filename) ^^^^^^^^Did you mean? exist? from rubycas-client (2.3.9) lib/casclient/tickets/storage.rb:129:in `cleanup_service_session_lookup'
According to Ruby 3.2's changelogs, File.exists has been removed:
Removed methods
The following deprecated methods are removed.
[...]
File.exists? [Feature #17391]
There are two references to File.exists? in the codebase, which need to be updated to File.exist?
| returnIO.read(ssl_filename)ifFile.exists?(ssl_filename) |
| end |
| |
| # Removes a stored relationship between a ServiceTicket and a local |
| # Rails session id. This should be called when the session is being |
| # closed. |
| # |
| # See #store_service_session_lookup. |
| defcleanup_service_session_lookup(st) |
| raiseCASException,"No service_ticket specified."ifst.nil? |
| |
| st=st.ticketifst.kind_of?ServiceTicket |
| ssl_filename=filename_of_service_session_lookup(st) |
| File.delete(ssl_filename)ifFile.exists?(ssl_filename) |
After upgrading to Ruby 3.2, we had the following error pop up in Sentry:
According to Ruby 3.2's changelogs,
File.existshas been removed:There are two references to
File.exists?in the codebase, which need to be updated toFile.exist?rubycas-client/lib/casclient/tickets/storage.rb
Lines 116 to 129 in 7b67c8f