Skip to content

Conversation

casperisfine
Copy link

There is no point computing them all and then later look them up.

cc @bf4

There is no point computing them all and then later
look them up.
@byroot byroot merged commit 14f465c into rails-api:0-9-stable Apr 10, 2024
@casperisfine casperisfine deleted the 0-9-stable-lazy-serializer-list branch April 10, 2024 07:41
serializer = Serializer.serializers_cache.fetch_or_store(klass_name) do
_const_get(klass_name)
end
return serializer unless serializer.nil?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I try to avoid return in a block. Break would work, too, no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Break could work yes. I find return from a block quite idomatic, but feel free to change the style if you feel strongly about it.

The goal here was first and foremost to reduce the overhead.

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.

3 participants