Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Bug in ri - cannot convert nil into Array

Thread Tools

Bug in ri - cannot convert nil into Array

John Carter
Posts: n/a
There seems to be a Bug in "ri" in the CVS-Latest (17-Jan-2005) version of

ri Set | cat
/usr/local/lib/ruby/1.9/rdoc/ri/ri_descriptions.rb:99:in `concat': cannot
convert nil into Array (TypeError)
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_descriptions.rb:99:in
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_reader.rb:56:in
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_reader.rb:52:in `each'
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_reader.rb:52:in
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_reader.rb:31:in
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_display.rb:97:in
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_display.rb:96:in `each'
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_display.rb:96:in
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_display.rb:77:in `page'
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_display.rb:77:in
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_driver.rb:71:in
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_driver.rb:106:in
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_driver.rb:135:in
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_driver.rb:134:in `each'
from /usr/local/lib/ruby/1.9/rdoc/ri/ri_driver.rb:134:in
from /usr/local/bin/ri:48
------------------------------------------------------------- Class: Set
Set implements a collection of unordered values with no duplicates.
This is a hybrid of Array's intuitive inter-operation facilities
and Hash's fast lookup.

Several methods accept any Enumerable object (implementing +each+)
for greater flexibility: new, replace, merge, subtract, |, &, -, ^.

The equality of each couple of elements is determined according to
Object#eql? and Object#hash, since Set uses Hash as storage.

Finally, if you are using class Set, you can also use
Enumerable#to_set for convenience.

require 'set'
s1 = [1, 2] # -> #<Set: {1, 2}>
s2 = [1, 2].to_set # -> #<Set: {1, 2}>
s1 == s2 # -> true
s1.add("foo") # -> #<Set: {1, 2, "foo"}>
s1.merge([2, 6]) # -> #<Set: {6, 1, 2, "foo"}>
s1.subset? s2 # -> false
s2.subset? s1 # -> true



================================================== ==================

If I have a look at
/usr/local/lib/ruby/1.9/rdoc/ri/ri_descriptions.rb:99, I see...
# merge in another class desscription into this one
def merge_in(old)
merge(@class_methods, old.class_methods)
merge(@instance_methods, old.instance_methods)
merge(@attributes, old.attributes)
merge(@constants, old.constants)
merge(@includes, old.includes)
if @comment.nil? || @comment.empty?
@comment = old.comment
@comment <<
@comment.concat old.comment

Where line 99 is...
@comment.concat old.comment

I take it then "old.comment" is nil

Give me a yell if you want me to doing any testing / instrumenting of this
for you.

John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : Removed)
New Zealand

"The notes I handle no better than many pianists. But the pauses
between the notes -
ah, that is where the art resides!' - Artur Schnabel

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
string+char, cant convert nil, but not nil Ruby 1 05-27-2008 04:57 AM
var = nil if false; p var.nil? #=> true | bug of the day ? Arie Kusuma Atmaja Ruby 6 04-11-2008 10:52 AM
Integer(nil) versus Float(nil) versus String(nil) Christoffer Sawicki Ruby 5 09-02-2006 06:28 PM
RCR 303: nil should accept missing methods and return nil John Carter Ruby 64 05-19-2005 12:12 PM
puts nil generates "nil\n" Brian Candler Ruby 1 11-06-2004 01:59 PM