Skip to main content

Introducing Keyword Arguments in Model Constructors in Ruby SDKs

· One min read

We have introduced the support for keyword arguments in model instantiation. By default, the model constructors expect the positional arguments in the Ruby SDKs.

What's New?

This update enforces the use of keyword arguments (kwargs) for all model constructor parameters. Previously, the positional arguments were allowed. Kwargs provide improved readability by explicitly naming arguments, and allow for more flexible model instantiation as the order no longer matters. This change promotes clarity and maintainability of the SDKs.

EnableModelKeywordArgsInRuby: true

For more details on the EnableModelKeywordArgsInRuby CodegenSetting and its impact on the SDK behavior, refer to the EnableModelKeywordArgsInRuby documentation. This setting is only applied to the model constructor parameters.

class User
def initialize(name, email)
@name = name
@email = email

# Creating a user (order matters!)
user ="Alice", "")