Bug #7636

Problems in the documnt of psych

Added by Ippei Obayashi over 1 year ago. Updated over 1 year ago.

[ruby-core:51193]
Status:Closed
Priority:Normal
Assignee:Zachary Scott
Category:doc
Target version:2.0.0
ruby -v:ruby 2.0.0dev (2012-12-01 trunk 38126) [x86_64-linux] Backport:

Description

I found some mistakes in the comment of psych library.

The following is the comment of Psych.load:
# Example:
#
# Psych.load("--- a") # => 'a'
# Psych.load("---\n - a\n - b") # => ['a', 'b']
#
# begin
# Psych.load("--- `", "file.txt")
# rescue Psych::SyntaxError => ex
# ex.file # => 'file.txt'
# ex.message # => "(foo.txt): found character that cannot start any token"
# end
The return value of ex.message is not correct. "foo.txt" should be "file.txt".
We can find the same errros on some other methods.

The attached patch fixes this problem. The patch also update the message
for newer versions.

psych-doc.patch Magnifier (1.46 KB) Ippei Obayashi, 12/29/2012 11:38 PM

Associated revisions

Revision 38680
Added by Zachary Scott over 1 year ago

  • ext/psych/lib/psych.rb (Psych.load): Return value of Psych::SyntaxError.message should be same as example. Patch by Ippei Obayashi [Bug #7636]

History

#1 Updated by Zachary Scott over 1 year ago

  • Assignee set to Zachary Scott
  • Target version set to 2.0.0

I'll have to check this upstream, psych is maintained on github (https://github.com/tenderlove/psych), but documentation patches here are fine.

#2 Updated by Zachary Scott over 1 year ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r38680.
Ippei, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/psych/lib/psych.rb (Psych.load): Return value of Psych::SyntaxError.message should be same as example. Patch by Ippei Obayashi [Bug #7636]

Also available in: Atom PDF