I'm wondering if there's an aspect of
File.open
generated_file = YAML::load_file("#{Rails.root}/documentation/auto_generated/liquid_drops/#{class_name}.yml")
File.open("#{Rails.root}/documentation/auto_generated/liquid_drops/#{class_name}.yml", 'w+') {|f| f.write generated_file.to_yaml }
example: "{% for file in object.method.all %} -- this would be the ideal method to iterate over a file's methods"
example: "{% for file in object.method.all %} -- this would be the ideal method
to iterate over a file's methods"
{
"class" => "account",
"methods" => [
{
"method_name" => "this_method",
"description" => "Donec sed odio dui. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio odio ma.",
"return_type" => "Array",
"example" => "{% for method in object.methods.all %}"
}
],
"general_notes" => "Most methods can use this instead of that, because this and that both inherit from the right file"
}
Turns out this was actually answered previously in "why does psych yaml interpreter add line breaks around 80 characters?". I was searching for the wrong thing.
Doing something like
yaml.to_yaml(:options = {:line_width => -1})
keeps the lines from wrapping.