Class: TkBindTag
Constant Summary
collapse
- BTagID_TBL =
TkCore::INTERP.create_table
- 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.
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/tk/bindtag.rb', line 61
def initialize(*args, &b)
Tk_BINDTAG_ID.mutex.synchronize{
@id = Tk_BINDTAG_ID.join(TkCore::INTERP._ip_id_)
Tk_BINDTAG_ID[1].succ!
}
BTagID_TBL.mutex.synchronize{
BTagID_TBL[@id] = self
}
bind(*args, &b) if args != []
end
|
Class Method Details
.new_by_name(name, *args, &b) ⇒ Object
def TkBindTag.new_by_name(name, *args, &b)
BTagID_TBL.mutex.synchronize{
return BTagID_TBL[name] if BTagID_TBL[name]
}
self.new.instance_eval{
BTagID_TBL.mutex.synchronize{
BTagID_TBL.delete @id
@id = name
BTagID_TBL[@id] = self
}
bind(*args, &b) if args != []
self
}
end
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/tk/bindtag.rb', line 46
def TkBindTag.new_by_name(name, *args, &b)
obj = nil
BTagID_TBL.mutex.synchronize{
if BTagID_TBL[name]
obj = BTagID_TBL[name]
else
(obj = BTagID_TBL[name] = self.allocate).instance_eval{
@id = name
}
end
}
bind(*args, &b) if obj && args != []
obj
end
|
Instance Method Details
83
84
85
86
|
# File 'lib/tk/bindtag.rb', line 83
def inspect
'#<TkBindTag: ' + @id + '>'
end
|
75
76
77
|
# File 'lib/tk/bindtag.rb', line 75
def name
@id
end
|
79
80
81
|
# File 'lib/tk/bindtag.rb', line 79
def to_eval
@id
end
|