Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9192515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:56:35+00:00 2026-06-17T20:56:35+00:00

I am trying to write a configuration file for an erlang application (rabbitmq) whose

  • 0

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 ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:56:36+00:00Added an answer on June 17, 2026 at 8:56 pm

    If I had to do this on my own, maybe something like:

    def to_erl(o)
      case o
      when Hash
        '[' +
           o.map {|(k,v)|
            "{#{k}, #{to_erl v}}"
           }.join(",\n") +
         ']'
      when Array
        '[' + o.map{|v| to_erl(v)}.join(",")  +']'
      when TrueClass then "true"
      when FalseClass then "false"
      when Integer then o.to_s
      when String then o
      when Symbol then o.to_s
      # ... and whatever else you can think of
      else
        raise "Don't know how to erlify #{o}"
      end
    end
    

    … 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_hash
    on 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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I write small application and trying connect jpa. in my spring configuration file
I'm trying to configure Logger to write to a file in the application configuration
I'm trying to write a log without having a configuration file by using Fluent
I'am trying to rewrite zend framework configuration file from application.ini to application.yml format and
I'm trying to write a program that dynamically defines ruby classes based on configuration
I'm trying to write a web application using Spring MVC. I have a configuration
I am trying to make my Emacs configuration file written for OS X work
Trying to write a couple of functions that will encrypt or decrypt a file
I'm trying to write validation rules for my data objects in a WPF application
I am trying to set some php configuration options using .htaccess file and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.