In my gem i require yaml
and works great on my computer locally.
But after pushing my gem into rubygems.org and when i try to use my gem i get an error saying => "uninitialized constant Psych::Syck (NameError)"
Can anyone help me to fix this problem?
P.S.
Ruby Version => ruby 1.9.2,
Gem Version => 1.6.2,
Bundler version => 1.0.15
After several hours of research I found that => "YAML uses the unmaintained Syck library, whereas Psych uses the modern LibYAML"
So in order to resolve that error, I had to update my gem (gem update --system
i.e. 1.8.6) and rescue the LoadError thrown by Psych before requiring yaml
, something like this:
begin
require 'psych'
rescue ::LoadError
end
require 'yaml'
Source:
http://pivotallabs.com/users/mkocher/blog/articles/1692-yaml-psych-and-ruby-1-9-2-p180-here-there-be-dragons
http://opinionatedprogrammer.com/2011/04/parsing-yaml-1-1-with-ruby/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With