There's an existing example in IRB's type completor: https://github.com/ruby/irb#debugging-with-irb https://github.com/ruby/repl_type_completor/