Giter Site home page Giter Site logo

Comments (3)

magynhard avatar magynhard commented on June 14, 2024

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.

blset avatar blset commented on June 14, 2024

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.

magynhard avatar magynhard commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.