Suggest
tells you which method does the thing you want to do
Disclaimer
I don't recommend you ship this in your Gemfile. Keep it in your system's gems (e.g. gem install
) and load it as needed (e.g. irb -rsuggest
, RUBY_OPT=-rsuggest irb
, etc)
Installation
gem install suggest_rb
Usage
require 'suggest'
# Object#what_returns? tells you which method returns the value
[1,2,3].what_returns? 1
=> [:first, :min]
# You can also specify the args you want that method to take
[1,2,3].what_returns? [1], args: [1]
=> [:first, :take, :grep, :min]
# By default, it only returns methods that don't mutate the object
[1,2,3].what_returns? [1], args: [1], allow_mutation
ā¦