I'm trying to generate a hash in yaml format, but by default, this method always adds --- in front of the 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, but it'll do the trick:
h.deep_stringify_keys.to_yaml[3..-1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With