chenge Blog

有趣地寻找Ruby方法

January 20, 2019

通常我们会从文档找,但这个比较低效和无聊。

suggest gem提供了一个新颖的方式。

require 'suggest'

# Object#what_returns? tells you which method returns the value
[1,2,3].what_returns? 1
=> [:first, :min]

怎么样,不错吧。


Written by chenge who lives and works in Shanghai China building useful things. You should follow him on Twitter or email: chenge3k at qq.com