Class: TkBindTag

Inherits:
Object show all
Includes:
TkBindCore
Defined in:
lib/tk/bindtag.rb

Direct Known Subclasses

TkBindTagAll, TkDatabaseClass

Constant Summary collapse

BTagID_TBL =

BTagID_TBL = {}

TkCore::INTERP.create_table
Tk_BINDTAG_ID =
["btag".freeze, "00000".taint].freeze
ALL =
self.new_by_name('all')

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TkBindCore

#bind, #bind_append, #bind_remove, #bindinfo

Constructor Details

#initialize(*args, &b) ⇒ TkBindTag

Returns a new instance of TkBindTag.



30
31
32
33
34
35
36
# File 'lib/tk/bindtag.rb', line 30

def initialize(*args, &b)
  # @id = Tk_BINDTAG_ID.join('')
  @id = Tk_BINDTAG_ID.join(TkCore::INTERP._ip_id_)
  Tk_BINDTAG_ID[1].succ!
  BTagID_TBL[@id] = self
  bind(*args, &b) if args != []
end

Class Method Details

.id2obj(id) ⇒ Object



15
16
17
# File 'lib/tk/bindtag.rb', line 15

def TkBindTag.id2obj(id)
  BTagID_TBL[id]? BTagID_TBL[id]: id
end

.new_by_name(name, *args, &b) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/tk/bindtag.rb', line 19

def TkBindTag.new_by_name(name, *args, &b)
  return BTagID_TBL[name] if BTagID_TBL[name]
  self.new.instance_eval{
    BTagID_TBL.delete @id
    @id = name
    BTagID_TBL[@id] = self
    bind(*args, &b) if args != []
    self
  }
end

Instance Method Details

#inspectObject



48
49
50
51
# File 'lib/tk/bindtag.rb', line 48

def inspect
  #Kernel.format "#<TkBindTag: %s>", @id
  '#<TkBindTag: ' + @id + '>'
end

#nameObject



40
41
42
# File 'lib/tk/bindtag.rb', line 40

def name
  @id
end

#to_evalObject



44
45
46
# File 'lib/tk/bindtag.rb', line 44

def to_eval
  @id
end