Unable to parse Ruby constants from YAML file #165

Closed
buckolas opened this Issue Oct 22, 2013 · 2 comments

2 participants

@buckolas

Here is an example YAML file, called 'sample.yml':

development:
verify: !ruby/module OpenSSL::SSL::VERIFY_NONE

Parsing this YAML file in the development.rb file, as shown here:

verify = YAML.load_file("#{Rails.root}/config/sample.yml")[Rails.env][:verify]

I get the following error:
TypeError: OpenSSL::SSL::VERIFY_NONE does not refer to class/module
from [Ruby Base]/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:312:in 'path2class'
.....

I have tried using !ruby/fixnum and other options in the YAML file, with no success. Any ideas on how to get the constant to parse properly?

@tenderlove
Owner

Can you try requiring openssl before parsing the file? I guess the constant doesn't exist.

@tenderlove
Owner

I'm closing this due to inactivity.

@tenderlove tenderlove closed this Aug 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment