! Fix class including a module with Memoizable raises error#62
Open
PikachuEXE wants to merge 1 commit intodry-rb:mainfrom
Open
! Fix class including a module with Memoizable raises error#62PikachuEXE wants to merge 1 commit intodry-rb:mainfrom
PikachuEXE wants to merge 1 commit intodry-rb:mainfrom
Conversation
94f017a to
6d849ad
Compare
Member
|
Excuse my ignorance but what is "concern module pattern"? :) Why is this patch needed? At first glance, I don't feel comfortable with having a workaround for a misused ruby API. |
Author
|
A brief example: require "dry/core/memoizable"
module WithBotDetection
include Dry::Core::Memoizable
def self.included(base)
# Do something custom
end
def is_bot?(something = false)
# ...
end
memoize :is_bot?
end
class Controller1
include WithBotDetection
end
class Controller2
include WithBotDetection
end
Controller1.new.is_bot? # => NoMethodError: undefined method `key?' for nil:NilClassDue to #61 only happens to methods with arguments More about "concern module pattern": |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My project uses "concern module pattern"
e.g. multiple controller classes including concern modules with instance methods cached
I am switching from memoist since it's officially unmaintained