Project

typeprof

0.41
There's a lot of open issues
TypeProf performs a type analysis of non-annotated Ruby code. It abstractly executes input Ruby code in a level of types instead of values, gathers what types are passed to and returned by methods, and prints the analysis result in RBS format, a standard type description format for Ruby 3.0. This tool is planned to be bundled with Ruby 3.0.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.8.1
 Project Readme

TypeProf: A type analysis tool for Ruby code based on abstract interpretation

Synopsis

gem install typeprof
typeprof app.rb

Demo

# test.rb
def foo(x)
  if x > 10
    x.to_s
  else
    nil
  end
end

foo(42)
$ typeprof test.rb
# Classes
class Object
  def foo : (Integer) -> String?
end

Documentation

English / 日本語

Playground

You can try typeprof gem on the Web via the URL below.

https://mame.github.io/typeprof-playground/