In Files

  • tk/lib/tk/texttag.rb

Parent

Methods

Class/Module Index [+]

Quicksearch

TktNamedTag

Public Class Methods

new(parent, name, *args) click to toggle source
 
               # File tk/lib/tk/texttag.rb, line 256
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
      # super(parent, name, *args)
      (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
            
new(parent, name, *args) click to toggle source
 
               # File tk/lib/tk/texttag.rb, line 289
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
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.