
September 20th, 2011, 02:54 AM
|
|
Registered User
|
|
Join Date: Sep 2011
Posts: 1
Time spent in forums: 26 m 51 sec
Reputation Power: 0
|
|
|
Ruby - Recursive stack level too deep
Hi there,
I'm trying to run the following script:
PHP Code:
class Node
data = nil
children = nil
attr_accessor :children, :data
def initialize(data, children=Array.new)
self.data = data
self.children = children
end
def addchild(child)
self.children << child
end
def printtree()
print self.data.url, "\n"
self.children.each{ |child|
print child.printtree()
}
end
end
But the method printtree is running till the stack level is too deep.... this is strange because it should not. So i'm sure I made a type in my ruby script. But i'm pretty new to ruby so obviously i don't see it haha.
Hope you can help me. That would be a blast!
Thanks,
Giac0m0
|