Introducing the Simple Config gem

require 'simple-config'

txt =<<EOF
file_path: abc def
description: xyx 123
EOF

SimpleConfig.parse txt
#=> {:file_path=>"abc def", :description=>"xyx 123"}

# and to write hash values back into the simple-config format
SimpleConfig.write(file_path: 'abc/132', description: '11 22 33')
#=> "file_path: abc/132\ndescription: 11 22 33"

Resources

Of course you could use YAML or JSON however I find the simple-config format more natural to read or write by hand.

Tags:
Source:
1334hrs.txt
Published:
11-11-2011 13:34