P
Pito Salas
I wanted an array:
big_array = [[1,2], [1,2], [1,2], [1,2]]
To convert into more readable yaml. (Yeah I know, YAML is for computers
to read and write but sometimes I want to eyeball it)
The default yaml I get is:
---
- - 1
- 2
- - 1
- 2
- - 1
- 2
- - 1
- 2
How ugly. I know that this is valid Yaml too:
--- [[1, 2], [1, 2], [1, 2], [1, 2]]
Sweet. I did it like this:
big_array = [[1,2], [1,2], [1,2], [1,2]]
def big_array.to_yaml_style; :inline; end
puts big_array.to_yaml
What? to_yaml_style? I found that lying around some list but can't find
any doc on it and couldn't even find it in the code. I know it must be
hiding.
Anyone know what other options there are for to_yaml_style? Because I
have some other needs that might already be built in.
Thanks much!
Pito
big_array = [[1,2], [1,2], [1,2], [1,2]]
To convert into more readable yaml. (Yeah I know, YAML is for computers
to read and write but sometimes I want to eyeball it)
The default yaml I get is:
---
- - 1
- 2
- - 1
- 2
- - 1
- 2
- - 1
- 2
How ugly. I know that this is valid Yaml too:
--- [[1, 2], [1, 2], [1, 2], [1, 2]]
Sweet. I did it like this:
big_array = [[1,2], [1,2], [1,2], [1,2]]
def big_array.to_yaml_style; :inline; end
puts big_array.to_yaml
What? to_yaml_style? I found that lying around some list but can't find
any doc on it and couldn't even find it in the code. I know it must be
hiding.
Anyone know what other options there are for to_yaml_style? Because I
have some other needs that might already be built in.
Thanks much!
Pito