intridea/hashie — pull request #228 by jperville (2014-09-16 09:06:40+00:00)
Title: Extend YamlErbParser to understand __FILE__ when interpolating ERB.

This modest PR sets the template filename when `Mash.load`-ing a YAML config file with ERB instructions.

The benefits :
- better stack trace (errors while rendering the ERB will display the template path instead of the `(erb)` placeholder string)
- allows to compute within the ERB template the path of resources bundled in the same package as the template (eg. `<% __FILE __%>`)

My use case: I'm working on a gem that generates code, the default configuration file for the generator is `Mash.load`-ed. Since the end-users are installing my gem with bundle, I cannot know where my gem and its bundled resources are installed, I can only know their path relative to the default configuration file so I need `__FILE__` to work.