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

Could #find_renderer be changed to not just instantiate? #14

Open
kennethkalmer opened this issue May 4, 2020 · 0 comments
Open

Could #find_renderer be changed to not just instantiate? #14

kennethkalmer opened this issue May 4, 2020 · 0 comments

Comments

@kennethkalmer
Copy link

Would you accept a patch to update the BaseNodeRenderer#find_renderer method to not just blindly instantiate a class, but instead If the renderer responds to #call, call that with the mappings & node. This allows for whoever is doing the renderer to pass their own lambdas or instantiated objects in with more state.

My particular use case is for rendering referenced entries. Having more configurable renderers that I can instantiate on my own means I can pass along a reference of all the referenced entries and continue rendering recursively.

I appreciate this will change the method signature to pass the mappings along with the node to #render, and there should be a backwards compatible way to do this

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

No branches or pull requests

1 participant