Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more

In Files

  • tk/lib/tk/textmark.rb

Parent

Methods

Class/Module Index [+]

Quicksearch

TkTextNamedMark

Public Class Methods

new(parent, name, index=nil) click to toggle source
 
               # File tk/lib/tk/textmark.rb, line 143
def self.new(parent, name, index=nil)
  TMarkID_TBL.mutex.synchronize{
    if TMarkID_TBL[parent.path] && TMarkID_TBL[parent.path][name]
      obj = TMarkID_TBL[parent.path][name]
    else
      # super(parent, name, *args)
      (obj = self.allocate).instance_eval{
        @parent = @t = parent
        @tpath = parent.path
        @path = @id = name
        TMarkID_TBL[@id] = self
        TMarkID_TBL[@tpath] = {} unless TMarkID_TBL[@tpath]
        TMarkID_TBL[@tpath][@id] = self unless TMarkID_TBL[@tpath][@id]
        @t._addtag @id, self
      }
      obj
    end

    if obj && index
      tk_call_without_enc(parent.path, 'mark', 'set', name,
                          _get_eval_enc_str(index))
    end
    obj
  }
end
            
new(parent, name, index=nil) click to toggle source
 
               # File tk/lib/tk/textmark.rb, line 169
def initialize(parent, name, index=nil)
  # 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
  tk_call_without_enc(@t.path, 'mark', 'set', @id,
                      _get_eval_enc_str(index)) if index
  @t._addtag @id, self
end