New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merged order wrong? #6
Comments
BTW: this seems to have a similar cause as #5 |
Actually...the example you show on the main page, is not working as written. The outcome I get is:
As you can see some of the items (especially the list of fruits) are in another order compared to the main page. Here they are in 'extensions last' Probably, often this does not matter, but in my case the order of array entries means something. |
Pull request #8 adds an option to yaml_extend to traverse the tree starting at the base class |
@NicoLugil, thank you very much for your issue and pull request. I would like to provide an option/fix for this requirement and will check your pull request soon. |
Hi @NicoLugil, i want to ensure to understand your problem exactly. Did you expect the following result in your example?
|
Correct! This is what my pull request gives if you use the option tree_traversal: :postorder YAML.ext_load_file 'settings.yaml' gives:
YAML.ext_load_file 'settings.yaml', tree_traversal: :postorder gives
|
Thank you very much for your reply and PR. As i figured out, the PR So i prefer using that solution and hope you don't feel bad when i have to reject your suggested solution. |
If it works then that is fine. |
The one thing I did like about my solution is the use of rubytree. |
I will definitely add more test cases, especially on the subject of the merging order. And I'll reconsider your remarks. |
I thought this package would be a very nice addition to a mechanism I have in place to specify settings/configurations...but it seems the order in which merged files end up in the final result are giving not the results I would desire.
My settings syntax is as follows:
The rules determine on what settings get applied. It is legal to list the same rule multiple times (that is why it is an array). If a setting is repeated, the 'last one wins' which feels most intuitive and follows what yaml does.
However in the following example:
Gives as result:
In which it is unfortunate that the extended base comes last in the list, as a result when I process the file the macros result in:
M_DERIVE: ja
M_BASE: ja
M_REPLACE: to_be replaced ---> should haven bee 'replaced'
Would it be difficult to put the merged list in the order from base --> derived? (maybe optional)
The text was updated successfully, but these errors were encountered: