# [Ruby On Rails][ruby] 找尋物件可用的方法:使用methods ###### tags: `Ruby On Rails`,`ruby` 參考資料: https://makandracards.com/makandra/22661-finding-a-method-name-on-a-ruby-object https://www.ruby-forum.com/t/show-a-listing-of-methods-unique-to-class/173978 在ruby中,幾乎所有的值都是物件, 每個物件都會有方法. 在terminal輸入irb可進入ruby的terminal. 列出所有方法: ```terminal 物件.methods ``` 搜尋包含特定字串的方法: ```terminal 物件.methods.grep /要搜尋的字串/ ``` 排除物件通用的方法: ```terminal (物件.public_methods - Object.public_methods).sort ```