YAML on Ruby 1.8.1 and Ruby 1.8.2

D

Dido Sevilla

I've written several programs that use YAML to store their
configuration files, and I generally run them on Ruby 1.8.2.
Occasionally we have a setup with a Ruby 1.8.1 or older version around
and noticed that the YAML module on these older versions of Ruby
behaves differently from that of 1.8.2. In particular, this YAML
string:

"--- :abc"

produces different results from 1.8.1 and 1.8.2. Under 1.8.2, I get
the expected behavior, and

YAML::load("--- :abc") => :abc

However, under 1.8.1:

YAML:load("--- :abc") => ":abc"

This totally breaks my config file scheme and is incredibly annoying.
Apparently, copying the YAML module from 1.8.2 to 1.8.1 doesn't fix
this behavior. I've had to write a short function to fix this brain
damage, but I wonder if there is a better way.
 
L

Lionel Thiry

Dido Sevilla a écrit :
I've written several programs that use YAML to store their
configuration files, and I generally run them on Ruby 1.8.2.
Occasionally we have a setup with a Ruby 1.8.1 or older version around
and noticed that the YAML module on these older versions of Ruby
behaves differently from that of 1.8.2. In particular, this YAML
string:

"--- :abc"

produces different results from 1.8.1 and 1.8.2. Under 1.8.2, I get
the expected behavior, and

YAML::load("--- :abc") => :abc

However, under 1.8.1:

YAML:load("--- :abc") => ":abc"

This totally breaks my config file scheme and is incredibly annoying.
Apparently, copying the YAML module from 1.8.2 to 1.8.1 doesn't fix
this behavior. I've had to write a short function to fix this brain
damage, but I wonder if there is a better way.

I've already answered, but my post doesn't appear in newsgroup. I retry:

YAML::load( "--- !ruby/sym abc" ) => :abc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,123
Latest member
Layne6498
Top