Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Another YAML bug?
Vladimir Marteev
11/22/2006 2:44:00 PM
[code]
#!/usr/bin/ruby1.8
require 'yaml'
a = { "b" => "c", "d" => nil, "e" => "f" }
puts a.to_yaml
[/code]
result:
---
b: c
d:
e: f
but must be:
---
b: c
d: ~
e: f
--
Posted via
http://www.ruby-...
.
1 Answer
Jacob Fugal
11/22/2006 3:45:00 PM
0
On 11/22/06, Vladimir Marteev <xor104@gmail.com> wrote:
> [code]
> #!/usr/bin/ruby1.8
> require 'yaml'
> a = { "b" => "c", "d" => nil, "e" => "f" }
> puts a.to_yaml
> [/code]
>
> result:
>
> ---
> b: c
> d:
> e: f
>
> but must be:
>
> ---
> b: c
> d: ~
> e: f
Not a bug.
According to [1] the canonical representation for !!null is indeed
'~', but the empty string (as well as the tokens 'null', 'Null' and
'NULL') are also acceptable representations. And we needn't worry
about confusion with the empty string since the empty string must be
represented with quotation marks, e.g.:
d: ""
There may be an argument that the YAML serialization of Ruby's nil
*should* be '~' instead of an empty string, but it is not the case
that it *must* be so.
Jacob Fugal
[1]
http://yaml.org/type...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Another YAML bug?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password