Not able to install cocoa pods after updating software to 14.3.1

Hello! I have recently formatted my machine and updated macOs to 14.3.1. Since then I am not able to install cocoapods. I tried multiple approaches in different articles but none of them could resolve my problem. It is showing error message as un supported ruby version and when I try to update ruby, I am getting the following error.

Error running '__rvm_make install', please read /Users/karthik/.rvm/log/1707916187/openssl_make.install.log

Please help in resolving this issue, Thanks in Advance.