Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
there is https://github.com/Shopify/rbi-central
Contracts gem can be a nice middle-ground. It has a fairly readably syntax and only checks method inputs and outputs at runtime. We use it to annotate important core methods, while leaving the rest type-free.
In my experience of working on complicated algorithmic project (spylls spellchecker) in Python after 15+ years of Ruby, I really liked the gradual typing experience: you write dynamic code to get a grip of the logic, and then start to add typing here and there - and it does help to clarify design, catch accidental null possibility, and in general make inter-module API more visible.
For now I just try to use better objects, avoiding primitive datatypes in internal code (using the null object pattern or an option/maybe class can go a long way), and using gems that do the same, such as dry-rb and money.
I haven't used rbs in the context of rails, but a quick googling leads me to https://github.com/pocke/rbs_rails , which includes some rake tasks to generate rbs files for models. There are also some libs to do the same for protobuf and json-schema (which I haven't tried yet as well).