Method: Tk::Iwidgets::Hierarchy#insert

Defined in:
lib/tkextlib/iwidgets/hierarchy.rb

#insert(index, chars, *tags) ⇒ Object



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/tkextlib/iwidgets/hierarchy.rb', line 304

def insert(index, chars, *tags)
  if tags[0].kind_of? Array
    # multiple chars-taglist argument :: str, [tag,...], str, [tag,...], ...
    args = [chars]
    while tags.size > 0
      args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ')  # taglist
      args << tags.shift if tags.size > 0                           # chars
    end
    super(index, *args)
  else
    # single chars-taglist argument :: str, tag, tag, ...
    if tags.size == 0
      super(index, chars)
    else
      super(index, chars, tags.collect{|x|_get_eval_string(x)}.join(' '))
    end
  end
end