Method: TkTextNamedTag#initialize

Defined in:
lib/tk/texttag.rb

#initialize(parent, name, *args) ⇒ TkTextNamedTag

Returns a new instance of TkTextNamedTag.



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/tk/texttag.rb', line 285

def initialize(parent, name, *args)
  # dummy:: not called by 'new' method

  #unless parent.kind_of?(Tk::Text)
  #  fail ArgumentError, "expect Tk::Text for 1st argument"
  #end
  @parent = @t = parent
  @tpath = parent.path
  @path = @id = name

  #if mode
  #  tk_call @t.path, "addtag", @id, *args
  #end
  if args != []
    keys = args.pop
    if keys.kind_of?(Hash)
      add(*args) if args != []
      configure(keys)
    else
      args.push keys
      add(*args)
    end
  end
  @t._addtag @id, self
end