The Ruby Runtime
Cloud Functions supports the following Ruby runtimes:
- Ruby 3.0 (recommended)
- Ruby 2.7
- Ruby 2.6
For instructions on how to prepare your local machine for Ruby development, see Setting up a Ruby development environment.
To get started with Ruby on Cloud Functions, see the Quickstart.
Selecting the runtime
You can select the Ruby runtime for your function during deployment.
gcloud
If you are using the Google Cloud CLI, you can specify the runtime
by using the --runtime
parameter. NAME specifies the
function name. For example:
gcloud functions deploy NAME --runtime ruby30 --trigger-http
For more arguments that you can specify when you are deploying, see Deploy using the gcloud tool.
Console
If you are using the Google Cloud console, you can select the runtime when you create and deploy a function. See the Google Cloud console quickstart for detailed instructions.
Execution environment
The execution environment includes the runtime, the operating system, and a library that invokes your function.
The Ruby runtime uses an execution environment based on Ubuntu 18.04. See Cloud Functions execution environment for more information.
The library that invokes your function is the Ruby Functions Framework.
Source code structure
In order for Cloud Functions to find your function's definition, each runtime has certain structuring requirements for your source code. See Writing Cloud Functions for more information.
Specifying dependencies
You can specify dependencies for your function by adding them to a project file. For more information, see Specifying dependencies in Ruby.
What's next
- Create your first Ruby function from scratch.