Essentials
Scalars
Extracting Scalar Values
Sometimes we just want to get quick results without defining a class for the response model, especially if we’re trying to get a straight, simple answer in a form of string, integer, boolean or float. Instructor provides a simplified API for such cases.
In this example, we’re extracting a single integer value from the text. You can also use Scalar::string()
, Scalar::boolean()
and Scalar::float()
to extract other types of values.
Additionally, you can use Scalar adapter to extract enums via Scalar::enum()
.