puppetlabs / ruby-hocon

A Ruby port of the Typesafe Config library.
Apache License 2.0
34 stars 30 forks source link

(HC-79) support :syntax arg in load #76

Closed cprice404 closed 8 years ago

cprice404 commented 8 years ago

This PR adds support for an optional opts map to be passed in to the simple load method. If provided, this map may contain a :syntax key that explicitly specifies which config format/syntax the user expects the file to be in.

This provides a way for users to load files whose file extension doesn't match the built-in expectations for which file extensions use which syntaxes.

The commit also provides some error checking for the case where an explicit :syntax is not passed in, and the file extension isn't recognized. In this case, we will throw an error now, rather than silently returning an empty map like we did in the past.

Finally, this commit adds some notes to the docs/example usage, indicating how to pass in an explicit syntax.

jpinsonault commented 8 years ago

👍 looks good to me

jpinsonault commented 8 years ago

@cowofevil since you found this, do you have any opinions?

cowofevil commented 8 years ago

I'm :+1: on this even if the .lock file stays in place.

janelu2 commented 8 years ago

:+1: I stared at this long and hard. I think it looks good and don't have any objections/comments to add.

cprice404 commented 8 years ago

@janelu2 @jpinsonault added a commit renaming that var.

janelu2 commented 8 years ago

WOOOOOO :fire: