122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/extjsml/basenode.rb', line 122
def find(xtype, option = nil)
return false unless has_child?
if(!option.nil? and option[:recursive])
return false if option[:recursive] == 0
option[:recursive] -= 1
end
found = false
childs.each do |c|
if c.xtype == xtype
unless option.nil?
match_option = true
option.each do |k, v|
next if k == :recursive
match_option = false if option[k] != c.config[k]
end
if match_option
found = c
break
end
else
found = c
break
end
end
found = c.find xtype, option
break if found
end
found
end
|