Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing memoize edge cases with predicate and bang methods #1727

Merged
merged 2 commits into from
Sep 6, 2022

Conversation

jwoertink
Copy link
Member

Purpose

Fixes #1396

Description

This allows you to memoize predicate and bang methods.

# this is now possible
memoize def current_user? : User?
  UserQuery.new.id(1).first?
end

Checklist

  • - An issue already exists detailing the issue/or feature request that this PR fixes
  • - All specs are formatted with crystal tool format spec src
  • - Inline documentation has been added and/or updated
  • - Lucky builds on docker with ./script/setup
  • - All builds and specs pass on docker with ./script/test

src/lucky/memoizable.cr Outdated Show resolved Hide resolved
@jwoertink jwoertink merged commit dd61285 into main Sep 6, 2022
@jwoertink jwoertink deleted the issues/1396 branch September 6, 2022 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memoize doesn't work with predicate methods
2 participants