Bugs: Browse | Submit New | Admin

[#7615] Invoking #siblings on root node throws NoMethodError

Date:
2007-01-06 03:06
Priority:
3
Submitted By:
Anupam Sengupta (anupamsg)
Assigned To:
Nobody (None)
Category:
Functionality
State:
Closed
Summary:
Invoking #siblings on root node throws NoMethodError

Detailed description
i found a bug in version 0.2.2: if you call #siblings without a block, you get 
an error:
/usr/local/lib/ruby/gems/1.8/gems/rubytree-0.2.2/lib/tree.rb:223:in 
`siblings': undefined method `children' for nil:NilClass (NoMethodError)

it's because you call #parent, which isn't defined. i fixed the bug for me by 
putting 

              return [self] if isRoot?

in line 221 in #siblings
i guess there's a more clever way to fix it. what about you? ;-)

Add A Comment: Notepad

Please login


Followup

Message
Date: 2007-01-06 03:09
Sender: Anupam Sengupta

Fixed in 0.2.3

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
status_idOpen2007-01-06 03:09anupamsg
resolution_idNone2007-01-06 03:09anupamsg
close_date2007-01-06 03:092007-01-06 03:09anupamsg