Questions: Two systems have different Ruby versions in a single React Native project. How can we set them dynamically in GemFile? One of your systems is using Ruby Version 2.7.5, and the other is 3.2.1.
Instead of using the different Ruby versions of different systems,
like as One of your systems is using Ruby Version 2.7.5 and the other is 3.2.1
So you can set it dynamically.
source 'https://rubygems.org'
# Check the Ruby version
if RUBY_VERSION =~ /^2\.7/
# Use gems for Ruby 2.7
ruby '2.7.5'
else
# Use gems for other Ruby versions
ruby '3.2.1'
end
gem 'cocoapods', '~> 1.11', '>= 1.11.2'
or
ruby '>=2.7.5'
gem 'cocoapods', '~> 1.11', '>= 1.11.2'