-
-
Save sixtyfive/50b71960530bb7fa25ec984eef46e82d to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
module MyModule | |
module MyHelper | |
module_function def helpermethod | |
puts "helpermethod" | |
end | |
end | |
private_constant :MyHelper | |
def modmethod | |
MyHelper.helpermethod | |
end | |
end | |
class MyClass | |
include MyModule | |
# include MyHelper # works (well, such is life) | |
def initialize | |
# modmethod # works | |
# modmethod # works | |
# helpermethod # works (*shrug*) | |
end | |
end | |
myobj = MyClass.new | |
myobj.modmethod # works (good) | |
# myobj.helpermethod # fails (good) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment