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

Type-specific rendering #109

Open
christopher-dG opened this issue Feb 14, 2020 · 3 comments
Open

Type-specific rendering #109

christopher-dG opened this issue Feb 14, 2020 · 3 comments

Comments

@christopher-dG
Copy link
Contributor

Is there currently a way to specify how we'd like Mustache to render a certain type? From a quick look at the code it seems like the method being called is print(io, val). Could Mustache have its own to_string(x)::String function to be overridden perhaps, then replace the existing print with print(io, to_string(val))?

@jverzani
Copy link
Owner

jverzani commented Feb 14, 2020 via email

@christopher-dG
Copy link
Contributor Author

christopher-dG commented Feb 14, 2020 via email

@oliviermilla
Copy link

That's a valid point. I would use render(io, object) for the naming with Mustache.render(io, object) defaulting to print.

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

3 participants