Why do Ruby refinements only modify classes, not modules?
问题 The Ruby docs on refinements state: Refinements only modify classes, not modules so the argument must be a class. Why is this? It's possible to monkey-patch a module: module MyModule def my_method "hello" end end include MyModule puts my_method # => hello module MyModule def my_method "goodbye" end end puts my_method # => goodbye I'm sure this isn't a good idea, but it might not be as bad if you could limit the scope of such a monkey patch. So why can't you? 回答1: The refine in Ruby is