手抜かり発見
素晴らしすぎる手抜かりを発見
こういうクラスを
こういうhashで
class ROOT
attr_accessor :name,:leaf
include HashConstObject
endclass LEAF
attr_accessor :name
include HashConstObject
end
構築しようとすると
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にしたほうがよいのかな.
ちょっと考えよう