252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
# File 'lib/tk/texttag.rb', line 252
def self.new(parent, name, *args)
tagobj = nil
TTagID_TBL.mutex.synchronize{
if TTagID_TBL[parent.path] && TTagID_TBL[parent.path][name]
tagobj = TTagID_TBL[parent.path][name]
else
(tagobj = self.allocate).instance_eval{
@parent = @t = parent
@tpath = parent.path
@path = @id = name
TTagID_TBL[@id] = self
TTagID_TBL[@tpath] = {} unless TTagID_TBL[@tpath]
TTagID_TBL[@tpath][@id] = self unless TTagID_TBL[@tpath][@id]
@t._addtag @id, self
}
end
}
if args != []
keys = args.pop
if keys.kind_of?(Hash)
tagobj.add(*args) if args != []
tagobj.configure(keys)
else
args.push keys
tagobj.add(*args)
end
end
tagobj
end
|