why does psych yaml interpreter add line breaks around 80 characters?

前端 未结 3 1607

Psych is the default yaml engine since ruby 1.9.3

Why, oh why does psych add a line break in its output? Check the example below.

ruby -v # => ruby 1.         


        
3条回答
  •  伪装坚强ぢ
    2021-02-07 13:20

    yaml.to_yaml(options = {:line_width => -1})
    

    is ok to solve the problem.

    but RuboCop say

    Useless assignment to variable - options.

    so

    yaml.to_yaml(line_width: -1)
    

    is better.

提交回复
热议问题