Created
February 8, 2013 02:02
-
-
Save armanm/4736034 to your computer and use it in GitHub Desktop.
To parse YAML with Ruby, do not use the YAML module, use Psych (which ships with Ruby 1.9.2, though there is also a gem). The reason is that YAML uses the unmaintained Syck library, whereas Psych uses the modern LibYAML:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> require 'yaml' | |
>> YAML.load("%YAML 1.1\n---\n'test'") # %YAML directive not supported | |
=> "%YAML 1.1 --- 'test'" | |
>> require 'psych' | |
>> Psych.load("%YAML 1.1\n---\n'test'") # all good | |
=> "test" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment