简体   繁体   中英

Psych can't parse simple key: value pair, Ruby, Yaml

Running in to some parsing problems with ruby 1.9.2-p290 and rails 3.1.3.

My YAML file looks like this:

api_key: 12345

The other YAML files parse fine, like the database.yml and locale files. It's just this one. Any ideas as to why?

there must be an error somwhere else, cause the line that you are showing is parsable by psych and syck engines:

YAML::ENGINE.yamler = 'psych'
YAML.load("api_key: 12345") # => {"api_key"=>12345}
YAML::ENGINE.yamler = 'syck'
YAML.load("api_key: 12345") # => {"api_key"=>12345}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM