You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 1.8.7:
irb(main):001:0> require 'yaml'
=> true
irb(main):007:0> YAML.load('foo: [?]')
=> {"foo"=>["?"]}
In 1.9.3:
irb(main):002:0> YAML.load('foo: [?]')
Psych::SyntaxError: (<unknown>): did not find expected ',' or ']' while parsing a flow sequence at line 1 column 6
from /Users/andrew.dupont/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:203:in `parse'
from /Users/andrew.dupont/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
from /Users/andrew.dupont/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:151:in `parse'
from /Users/andrew.dupont/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:127:in `load'
from (irb):2
from /Users/andrew.dupont/.rbenv/versions/1.9.3-p392/bin/irb:12:in `<main>'
In PDoc, `?` can be an argument type and a return type. When it's an argument type, we end up with `types: [?]` in the YAML file, and though that was OK before Psych existed, it's not OK now. This was preventing documentation from being generated from at least Ruby 1.9.3 onward.
The solution is to put quotes around the types so that YAML knows we mean for them to be strings.
This ends up not being a problem for the return type (`return_value` in the YAML) because it ends up being escaped, as are most of the values in the YAML output.
0 commit comments