Skip to content
This repository

YAML.load_file to empty file gives false #258

Closed
BrandonMathis opened this Issue August 09, 2012 · 3 comments

4 participants

BrandonMathis Charles Oliver Nutter Lucas Aaron Patterson
BrandonMathis

When parsing a YAML doc.

Got

irb(main):002:0> YAML.load_file File.join("spec","fixtures","empty.yml")
=> false

Expected

irb(main):002:0> YAML.load_file File.join("spec","fixtures","empty.yml")
=> {}

Is this expected or would a patch to return an empty hash be accepted?

Lucas

Hello @KeysetTS!

Ruby 1.9.3 acts the same way, in fact I think it's not a ruby or jruby behavior, because ruby and jruby use the psych as engine to work with yaml [1], [2].

So if you want suggest it, you should do it in the appropriate repository [3].

If I'm mistaken, someone please correct me :)

[1] https://github.com/ruby/ruby/blob/trunk/lib/yaml.rb#L42
[2] https://github.com/jruby/jruby/blob/master/lib/ruby/1.9/yaml.rb#L64
[3] https://github.com/tenderlove/psych/

Charles Oliver Nutter
Owner

Yeah, if we match 1.9.3, then this is not our bug. @tenderlove has been working to improve sharing between the JRuby and MRI impls, and would probably welcome a bug report about this.

Charles Oliver Nutter headius closed this September 20, 2012
Aaron Patterson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.