Re: Is it possible to read any file(.txt or .yml) into config.yml file and read values from that file.
Trans <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
On May 5, 4:32 pm, harry <[email protected]> wrote: > Hello All, > > I am using yaml config file for Ruby language. > > Here I am facing a situtation where in I need to have a config file which is > supposed to read another config file. > > Such as say I have two config files config1.yml and config2.yml where in > config2.yml is supposed to get hashes/lists from config1.yml. > > My question here is that Is it possible to do this with yml files and also > if it is possible Can someone please help me out on this. > > As I was searching online and couldn't find any proper documentation on yml > config. > > So please can someone help me solve this. Not possible by YAML alone. But you might be able to write your own preprocessor. Another option that I have used is to process the file through ERB, before parsing it. This would allow youd to do such like: --- a: 1 b: 2 <%= File.read('config2.yml') %> But of course you have to be careful with formating in cases like this. ------------------------------------------------------------------------------