Comments (3)
Hi @blset , thank you for your question.
I can not reproduce your problem, relative path from the config file is working fine for me, as do the rspec tests as well.
An example file structure:
main.rb
config/file.yml
config/other.yml
The files containing that code:
# main.rb
require 'yaml_extend'
config = YAML.ext_load_file 'config/file.yml'
p config
# file.yml
extends:
- 'other.yml'
core: 'core string'
# other.yml
other_options: 'some string'
Running the program
ruby main.rb
gives the following output:
{"core"=>"core string", "other_options"=>"some string"}
Conclusion
There might have been a typo in your code or it is a platform specific issue.
Can you provide me information about your
- ruby version (
ruby -v
) and - platform (Operating System)
from yaml_extend.
ruby 2.6.3 on ubuntu 18 04 LTS
but you are right, that must have been a typo, I make it work now
thank you very much
just one more question, while we are on conversation
if I put the extend key under an option key, does that mean the yaml other file is loaded under the option key ?
#other .yml
key1: o
key2: o
# main.yml
option:
extend: 'other.yml'
key1: 1
this result or :
key1: 1
option:
key1: o
key2: o
this result
key1: o
key2: o
from yaml_extend.
Thank you for your reply.
The extension always takes place at root level, independent of the key and its level.
The YAML files are just merged together, that's it.
So your last result example is what will happen.
from yaml_extend.
Related Issues (11)
- Override only works for string values HOT 2
- ext_load_file mutates/removes some falsey keys HOT 5
- Extend existing array option overwriting values in array HOT 1
- undefined method `start_with?' for #<Pathname:0x00000006327430> HOT 2
- Need to pass options through to Psych HOT 2
- Emulating nested settings HOT 15
- Boolean keys with value "true" in base YAML are not overwritten by "false" in extended YAMLs HOT 4
- Issues with the order extends work HOT 3
- merged order wrong? HOT 10
- Inheriting from several files does not merge them top to bottom HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yaml_extend.