Repository navigation
How can I include a module? #162
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestp3questionFurther information is requestedFurther information is requested
Description
Activity
Hi @ejstembler, apologies for not noticing this sooner.
Conceptually, the block you provide to
FunctionsFramework.httpis a "function" (i.e. a method), not a class, so you can't callModule#includefrom it. But you can callObject#extend. The following should work:FunctionsFramework.http 'my_function' do |request| extend GoogleCloudLoggable # ... end
That said, let's leave this issue open. You bring up a good use case, and I think it would be good to provide a way to include modules in the underlying class rather than extending every instance individually.
@dazuma Do you already know what you'd like to happen in the block to make include work normally or would a PR for this be acceptable from an outside contributor (me)?
- addedquestionFurther information is requestedFurther information is requested
on Sep 25, 2023 @Spaceghost if you're still up to it, a PR would be welcome.
Reacted by Johnneylee Jack Rollins- added 8 commits that reference this issue
on Feb 5, 2025
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestp3questionFurther information is requestedFurther information is requested
Normally one would add module includes inside the class. How can this be done with
FunctionsFramework?For example, this doesn't work: