luckyframework / lucky

A full-featured Crystal web framework that catches bugs for you, runs incredibly fast, and helps you write code that lasts.
https://luckyframework.org
MIT License
2.57k stars 156 forks source link

Fixing memoize edge cases with predicate and bang methods #1727

Closed jwoertink closed 1 year ago

jwoertink commented 1 year ago

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