ruby on rails - Is it possible to insert new keys in middle of anchor array using YAML? -


i have yaml file anchor array this.

sammy: &as   -   - c 

and want add new key, in following manner:

mobile:   <<: *as # want add new element in between & c   # i.e.   # new mobile should   # b c 

is possible?
note: i'm using ysets retrieve these keys in app.

no not possible. reason anchored element, alias as refers to, has mapping according specification merge keys.

and element (i.e. value sammy) sequence, not mapping, not going work.

this reason why checking:

sammy: &as   -   - c mobile:   <<: *as 

online gives error.

the way around like:

sammy: &as   1:   3: c mobile:   <<: *as   2: b 

and use values of mobile sorted keys.


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -