I am trying to write a configuration file for an erlang application (rabbitmq) whose conf si written as an erlang term 1.
My attribute is a ruby hash, do you know how I can convert this hash to a pretty printed erlang term ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If I had to do this on my own, maybe something like:
… But I bet there’s some nice code you can steal off of some
open source project that has to serialize between ruby and erlang.
For serialization to
erlang, BERT is the defacto (Binary Erlang terms).There’s lots of libraries that go from Ruby hashes to BERT, it seems.
Haven’t seen one that gives you plain textual erlang terms.
Since this is for a chef recipe, it’s a good idea not to mess with
too many ruby dependencies at converge time. You’ll be calling
#to_hashon your chef attributes, and what you will get back will straight-forward
enough (no objects, just number/bools/strings/arrays and hashes I guess)
to manage with a bit of home grown code.