-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[WIP] Template Handler Refactoring #34952
Merged
Merged
Conversation
This file contains 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
This pulls the "output buffer existence" conditional up. Instead of evaling the same conditional over and over, we can pull it in to "only compiled once" Ruby code.
Methods created by views should always be evaluated against an AV::Base instance. This way we can extract and refactor things in to classes.
tenderlove
force-pushed
the
template-stuff
branch
from
January 17, 2019 01:32
264abd2
to
c740ebd
Compare
Since everything goes through a `run` method, we can pull the buffer assignment up.
It's always called with 0 params, so just remove the parameter
This patch removes the instance writer of view_context_class. Subclasses may override it, but it doesn't need to be written. This also eliminates the need to cache the return value of the class level `view_context_class` method.
We always want to include this module. It'll be used in production (maybe)
Rather than doing is_a? checks, ask the view object for its compiled method container. This gives us the power to replace the method container depending on the instance of the view.
I think these changes are safe, so I'm going to merge them. I've got some more, possibly less safe stuff that depends on these changes, so I'll send a new PR with them. |
👍 |
mrpinsky
pushed a commit
to polleverywhere/haml_coffee_assets
that referenced
this pull request
Sep 3, 2020
As of rails/rails#34952, the fallback for nil buffer was moved up to the method call's default argument. The `nil` default here is passed to the original method (`old_render`), preventing the default from being applied. This meant that any template going through this monkey patch on Rails 6 blew up when it tried to call methods on the buffer.
mathieujobin
pushed a commit
to payrollhero/haml_coffee_assets
that referenced
this pull request
Feb 12, 2021
As of rails/rails#34952, the fallback for nil buffer was moved up to the method call's default argument. The `nil` default here is passed to the original method (`old_render`), preventing the default from being applied. This meant that any template going through this monkey patch on Rails 6 blew up when it tried to call methods on the buffer.
derSascha
pushed a commit
to derSascha/haml_coffee_assets
that referenced
this pull request
Apr 22, 2021
As of rails/rails#34952, the fallback for nil buffer was moved up to the method call's default argument. The `nil` default here is passed to the original method (`old_render`), preventing the default from being applied. This meant that any template going through this monkey patch on Rails 6 blew up when it tried to call methods on the buffer.
mathieujobin
pushed a commit
to payrollhero/haml_coffee_assets
that referenced
this pull request
Apr 29, 2021
As of rails/rails#34952, the fallback for nil buffer was moved up to the method call's default argument. The `nil` default here is passed to the original method (`old_render`), preventing the default from being applied. This meant that any template going through this monkey patch on Rails 6 blew up when it tried to call methods on the buffer.
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.
Someone at work wants to add a new way to do templating, so I've been poking at the way we do template compilation. I just want to try out some stuff here and see if it passes CI. Maybe we can merge some of it.