I am modifying a YAML file in Ruby. After I write back the modified YAML, I see a ---
added on top of the file. How is this getting added and how do I get rid of it?
相关问题
- facebook error invalid key hash for some devices
- How to install local library with pip to a conda e
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
- reference to a method?
相关文章
- Ruby using wrong version of openssl
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- “No explicit conversion of Symbol into String” for
- Segmentation fault with ruby 2.0.0p247 leading to
- How to detect if an element exists in Watir
- Bcrypt vs Hash in laravel
- uninitialized constant Mysql2::Client::SECURE_CONN
YAML spec says:
Example:
So if you have multiple documents per YAML file, you have to separate them by three dashes. If you only have one document, you can remove/omit it (I never had a problem with YAML in ruby if three-dashes was missing). The reason why it's added when you yamlify your object is that, I guess, the dumper is written "by the spec" and doesn't care to implement such "shortcuts" (omit three-dashes when it's only one document).