Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for load_stream #79

Open
randomstuff opened this issue Sep 25, 2015 · 0 comments
Open

No support for load_stream #79

randomstuff opened this issue Sep 25, 2015 · 0 comments

Comments

@randomstuff
Copy link

As far as I understand, safe_yaml does not support the load_stream method (or any form of YAML steam loading).

require "safe_yaml"

# File.open "bla.yaml" do |f|
#   YAML.load_stream(f, :safe=>truew)
# end

v = <<EOF
--- !ruby/hash:ClassBuilder
"foo; end; puts %(I'm in yr system!); def bar": "baz"

---
EOF

puts "Load\n\n"
puts(YAML.load(v))

puts "\nLoad stream\n\n"
puts(YAML.load_stream(v))

Gives:

Load

Called 'load' without the :safe option -- defaulting to safe mode.
You can avoid this warning in the future by setting the SafeYAML::OPTIONS[:default_mode] option (to :safe or :unsafe).
{"foo; end; puts %(I'm in yr system!); def bar"=>"baz"}

Load stream

/usr/lib/ruby/2.1.0/psych/class_loader.rb:53:in `path2class': undefined class/module ClassBuilder (ArgumentError)
        from /usr/lib/ruby/2.1.0/psych/class_loader.rb:53:in `resolve'
        from /usr/lib/ruby/2.1.0/psych/class_loader.rb:45:in `find'
        from /usr/lib/ruby/2.1.0/psych/class_loader.rb:27:in `load'
        from /usr/lib/ruby/2.1.0/psych/visitors/to_ruby.rb:360:in `resolve_class'
        from /usr/lib/ruby/2.1.0/psych/visitors/to_ruby.rb:261:in `visit_Psych_Nodes_Mapping'
        from /usr/lib/ruby/2.1.0/psych/visitors/visitor.rb:15:in `visit'
        from /usr/lib/ruby/2.1.0/psych/visitors/visitor.rb:5:in `accept'
        from /usr/lib/ruby/2.1.0/psych/visitors/to_ruby.rb:31:in `accept'
        from /usr/lib/ruby/2.1.0/psych/visitors/to_ruby.rb:276:in `visit_Psych_Nodes_Document'
        from /usr/lib/ruby/2.1.0/psych/visitors/visitor.rb:15:in `visit'
        from /usr/lib/ruby/2.1.0/psych/visitors/visitor.rb:5:in `accept'
        from /usr/lib/ruby/2.1.0/psych/visitors/to_ruby.rb:31:in `accept'
        from /usr/lib/ruby/2.1.0/psych/nodes/node.rb:37:in `to_ruby'
        from /usr/lib/ruby/2.1.0/psych.rb:456:in `block in load_stream'
        from /usr/lib/ruby/2.1.0/psych.rb:456:in `map'
        from /usr/lib/ruby/2.1.0/psych.rb:456:in `load_stream'
        from test.rb:19:in `'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant