Difference between . and #

后端 未结 3 924
抹茶落季
抹茶落季 2020-12-23 20:37

In Ruby what is the difference between those two (in code):

  • Class.method
  • Class#method
3条回答
  •  礼貌的吻别
    2020-12-23 21:36

    It's a naming convention.

    • use pound #method for instance methods
    • use dot .method for class methods

    See: How to name RSpec describe blocks for methods

提交回复
热议问题