-
-
Save kaosf/cc7f3cc068a8eccf599a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'active_support' | |
| module M1 | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| def cm | |
| puts 'M1.cm' | |
| end | |
| end | |
| end | |
| module M2 | |
| extend M1 | |
| end | |
| class C | |
| include M2 | |
| end | |
| #C.cm | |
| #xxxx:20:in `<main>': undefined method `cm' for C:Class (NoMethodError) | |
| # WHY? | |
| module M3 | |
| extend ActiveSupport::Concern | |
| included do | |
| include M1 | |
| end | |
| end | |
| class C2 | |
| include M3 | |
| end | |
| C2.cm | |
| #=> M1.cm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment