手抜かり発見

素晴らしすぎる手抜かりを発見
こういうクラスを


class ROOT
attr_accessor :name,:leaf
include HashConstObject
end

class LEAF
attr_accessor :name
include HashConstObject
end

こういうhashで

constinfo ={
:constinfo =>{:root=> "ROOT",:leaf =>"LEAF"},
"ROOT"=>{:name => "root"},
"LEAF"=>{:name => "leaf"}
}
構築しようとすると

class ROOT
attr_accessor :name,:leaf1,:leaf2
include HashConstObject
end
のときにはまるのか

constinfo ={
:constinfo =>{:root=> "ROOT",:leaf1 =>"LEAF",:leaf2=>"LEAF"},
:root=>{:name => "root"},
:leaf1=>{:name => "leaf1"},
:leaf2=>{:name => "leaf2"}
}
なのか,実は
素直にTreeにしたほうがよいのかな.
ちょっと考えよう

[permalink][contents][page top]