What are the restrictions for method names in Ruby?

前端 未结 5 1090
甜味超标
甜味超标 2020-11-27 16:03

For example, I found the method name bundler? in the following snippet, and don\'t know whether the ? character is a specialized keyword or just pa

5条回答
  •  自闭症患者
    2020-11-27 16:15

    Method names can end in !, ? or =. Underscores are allowed as well. Besides that there are several methods that look like operators (e.g. +, *, >>, []) that you can define for your own classes.

提交回复
热议问题