'RBS Return type depending of self parameterized type

I noticed for some reason, in my IDE (RubyMine) ActiveRecord::FinderMethods#first have an 'Array' return type in the signature, but if you don't pass any param it returns the first record, so i would like to fix this type inference using RBS files, i already know how method overloading works in RBS, but i don't understand how to make the return type equal to the parameterized type of the class.

E.g: If I have an ActiveRecord::Relation<User> and i call the #first method on it without any param, I expect the return type to be User or nil, and if i call it with an Integer argument, i expect to return an Array<User>.

Thanks in advance.



Solution 1:[1]

You need to install gcc to have the build tools needed. You can get this through apt by installing gcc or install the build-essential meta-package which will include gcc and other common build requirements.

image: python:3.9-slim
pages:
  before_script:
    - apt update && apt install -y build-essential libgdal-dev

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sytech