| #!/usr/bin/env ruby | |
| module A | |
| def a1 | |
| p "a1" | |
| end | |
| def a2 | |
| p "a2" | |
| end | |
| end | |
| module B | |
| def a1 | |
| p "b1" | |
| end | |
| def a2 | |
| p "b2" | |
| end | |
| end | |
| class Sample | |
| include A | |
| include B | |
| def s1 | |
| p "s1" | |
| end | |
| end | |
| samp=Sample.new | |
| # FIXME how to call method A's method a1 instead of module B's method ? | |
| samp.a1 # want to call module A's method a1 | |
| samp.a2 # want to call module A's method a2 | |
| samp.a1 # call module B's method a1 | |
| samp.a2 # call module B's method a1 | |
| samp.s1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment