Guaranteeing that module includer classes have access to logger
#230
Unanswered
keithrbennett
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
I asked this question on StackOverflow at https://stackoverflow.com/questions/73676857/guaranteeing-that-module-includer-classes-include-another-module-in-ruby. The answer was to do this: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have some modules whose instance methods call
logger. If I callinclude SemanticLogger::Loggablein the module, it makes aloggermethod accessible to module "class" methods, but not instance methods, since modules don't have instances and the module instance methods become methods of the including class.So for the
loggercall not to fail, I need to ensure that any class that includes my module also includesSemanticLogger::Loggable. What's the best way to deal with this? Maybe this?:Beta Was this translation helpful? Give feedback.
All reactions