How to use to_yaml method in Rails, and remove '---' -


i'm trying generate hash in yaml format, default, method adds --- in front of object.

> h = {key1: 'v1', key2: 'v2'} => {:key1=>"v1", :key2=>"v2"} > h.deep_stringify_keys.to_yaml => "---\n:key1: v1\n:key2: v2\n" 

brute force, it'll trick:

h.deep_stringify_keys.to_yaml[3..-1] 

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' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -