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

default template locals #13

Merged
merged 1 commit into from
Nov 25, 2014
Merged

default template locals #13

merged 1 commit into from
Nov 25, 2014

Conversation

kellyredding
Copy link
Member

This updates the source to optionally take default template locals.
Locals are applied to an anonymous subclass of Template and this
subclass is used to do all source renderings.

The goal here is to apply a local that is used across all renders -
one you don't have to remember to pass in and applies to both top
level renders and partial renders. Specifically, this will be used
by both the deas and sanford nm adapters to make their logger
available in the templates.

@jcredding I realized the logger stuff I did in deas-nm previously won't fully work as the logger won't be available in partial calls. I had to go deeper and effect the template scope itself. Thus this feature. I'll go back and update deas-nm and sanford-nm to take advantage of this in coming PRs.

This updates the source to optionally take default template locals.
Locals are applied to an anonymous subclass of `Template` and this
subclass is used to do all source renderings.

The goal here is to apply a local that is used across all renders -
one you don't have to remember to pass in and applies to both top
level renders and partial renders.  Specifically, this will be used
by both the deas and sanford nm adapters to make their `logger`
available in the templates.
@jcredding
Copy link
Member

@kellyredding - I follow, looks good 💥

kellyredding added a commit that referenced this pull request Nov 25, 2014
@kellyredding kellyredding merged commit 7dd8382 into master Nov 25, 2014
@kellyredding kellyredding deleted the kr-default-locals branch November 25, 2014 15:57
kellyredding added a commit that referenced this pull request Nov 25, 2014
* cleanup to the bench script cmd comments (2e74a17)
* update gemspec to not package bench or script dirs (e3cea45)
* switch how locals are applied to template metaclass - an optimization #12
* default template locals #13
* define custom inspects for both `Source` and `Template` #14

/cc @jcredding
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.

2 participants