Class: TclTkVariable
- Inherits:
-
TclTkObject
- Object
- TclTkObject
- TclTkVariable
- Defined in:
- lib/tcltk.rb
Overview
class TclTkVariable: tcl/tk variable
Instance Method Summary collapse
-
#get ⇒ Object
get(): read tcl/tk variable(String) using ‘set’.
-
#initialize(interp, dat) ⇒ TclTkVariable
constructor
initialize(interp, dat): interp: interpreter(TclTkInterpreter) dat: the value to set(String) if nil, not initialize variable.
-
#set(data) ⇒ Object
set(data): set tcl/tk variable using ‘set’ data: new value.
Methods inherited from TclTkObject
Constructor Details
#initialize(interp, dat) ⇒ TclTkVariable
initialize(interp, dat):
interp: interpreter(TclTkInterpreter)
dat: the value to set(String)
if nil, not initialize variable
230 231 232 233 234 235 236 237 238 239 |
# File 'lib/tcltk.rb', line 230 def initialize(interp, dat) # auto-generate tcl/tk representation (variable name) exp = TclTk._newname("v_") # initialize TclTkObject super(interp._tcltkip(), exp) # safe this for `set' command @set = interp.commands()["set"] # set value set(dat) if dat end |
Instance Method Details
#get ⇒ Object
get(): read tcl/tk variable(String) using ‘set’
251 252 253 |
# File 'lib/tcltk.rb', line 251 def get() return @set.e(to_s()) end |
#set(data) ⇒ Object
set(data): set tcl/tk variable using ‘set’
data: new value
246 247 248 |
# File 'lib/tcltk.rb', line 246 def set(data) @set.e(to_s(), data.to_s()) end |