In Files

  • tk/lib/tk/variable.rb

Parent

Methods

Included Modules

Class/Module Index [+]

Quicksearch

TkVariable

Public Class Methods

callback(id, name1, name2, op) click to toggle source

def ::callback

 
               # File tk/lib/tk/variable.rb, line 56
  def TkVariable.callback(id, name1, name2, op)
    #name1,name2,op = tk_split_list(args)
    #name1,name2,op = tk_split_simplelist(args)
    if cb_obj = TkVar_CB_TBL[id]
      #_get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
      begin
        _get_eval_string(cb_obj.trace_callback(name2, op))
      rescue SystemExit
        exit(0)
      rescue Interrupt
        exit!(1)
      rescue Exception => e
        begin
          msg = _toUTF8(e.class.inspect) + ': ' +
                _toUTF8(e.message) + "\n" +
                "\n---< backtrace of Ruby side >-----\n" +
                _toUTF8(e.backtrace.join("\n")) +
                "\n---< backtrace of Tk side >-------"
          if TkCore::WITH_ENCODING
            msg.force_encoding('utf-8')
          else
            msg.instance_variable_set(:@encoding, 'utf-8')
          end
        rescue Exception
          msg = e.class.inspect + ': ' + e.message + "\n" +
                "\n---< backtrace of Ruby side >-----\n" +
                e.backtrace.join("\n") +
                "\n---< backtrace of Tk side >-------"
        end
        fail(e, msg)
      end
      begin
        raise 'check backtrace'
      rescue
        # ignore backtrace before 'callback'
        pos = -($!.backtrace.size)
      end
      begin
        _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
      rescue
        trace = $!.backtrace
        raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" +
                  "\tfrom #{trace[1..pos].join("\n\tfrom ")}"
      end
    else
      ''
    end
  end
            
new(val="", type=nil) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 283
  def initialize(val="", type=nil)
    # @id = Tk_VARIABLE_ID.join('')
    begin
      Tk_VARIABLE_ID.mutex.synchronize{
        @id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_)
        Tk_VARIABLE_ID[1].succ!
      }
    end until INTERP._invoke_without_enc('info', 'globals', @id).empty?

    TkVar_ID_TBL.mutex.synchronize{
      TkVar_ID_TBL[@id] = self
    }

    @var  = @id
    @elem = nil

    @def_default = false
    @default_val = nil

    @trace_var  = nil
    @trace_elem = nil
    @trace_opts = nil

    @type = nil
    var = self
    @element_type = Hash.new{|k,v| var.default_value_type }

    self.default_value_type = type

    # teach Tk-ip that @id is global var
    INTERP._invoke_without_enc('global', @id)
    #INTERP._invoke('global', @id)

    # create and init
    if val.kind_of?(Hash)
      # assoc-array variable
      self[''] = 0
      self.clear
    end
    self.value = val

    if val == []
      # INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)',
      #                     @id, @id, @id))
    elsif val.kind_of?(Array)
      a = []
      # val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
      # s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
      val.each_with_index{|e,i| a.push(i); a.push(e)}
      #s = '"' + array2tk_list(a).gsub(/[\[\]$"]/, '\\\\\&') + '"'
      s = '"' + array2tk_list(a).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
      INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
    elsif  val.kind_of?(Hash)
      #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
      #             .gsub(/[\[\]$"]/, '\\\\\&') + '"'
      s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
                   .gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
      INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
    else
      #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
      s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
      INTERP._eval(format('global %s; set %s %s', @id, @id, s))
    end
    if  val.kind_of?(Hash)
      #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
      #             .gsub(/[\[\]$"]/, '\\\\\&') + '"'
      s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
                   .gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
      INTERP._eval(Kernel.format('global %s; array set %s %s', @id, @id, s))
    else
      #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
      s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
      INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
    end
  end
            
new_hash(val = {}) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 107
def self.new_hash(val = {})
  if val.kind_of?(Hash)
    self.new(val)
  else
    fail ArgumentError, 'Hash is expected'
  end
end
            

Public Instance Methods

%(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1227
def %(other)
  num_or_str(self._value) % other
  #begin
  #  number(self._value) % other
  #rescue
  #  self._value % other
  #end
end
            
&(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1181
def &(other)
  if other.kind_of?(Array)
    self.to_a & other.to_a
  else
    self.to_i & other.to_i
  end
end
            
*(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1216
def *(other)
  num_or_str(self._value) * other
  #begin
  #  number(self._value) * other
  #rescue
  #  self._value * other
  #end
end
            
**(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1235
def **(other)
  number(self._value) ** other
end
            
+(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1195
def +(other)
  case other
  when Array
    self.to_a + other
  when String
    self._value + other
  else
    begin
      number(self._value) + other
    rescue
      self._value + other.to_s
    end
  end
end
            
+@() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1174
def +@
  self.numeric
end
            
-(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1209
def -(other)
  if other.kind_of?(Array)
    self.to_a - other
  else
    number(self._value) - other
  end
end
            
-@() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1177
def -@
  -(self.numeric)
end
            
/(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1224
def /(other)
  number(self._value) / other
end
            
<=>(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1281
def <=>(other)
  if other.kind_of?(TkVariable)
    begin
      val = other.numeric
      other = val
    rescue
      other = other._value
    end
  elsif other.kind_of?(Numeric)
    begin
      return self.numeric <=> other
    rescue
      return self._value <=> other.to_s
    end
  elsif other.kind_of?(Array)
    return self.list <=> other
  else
    return self._value <=> other
  end
end
            
==(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1242
def ==(other)
  case other
  when TkVariable
    #self.equal?(other)
    self._value == other._value
  when String
    self.to_s == other
  when Symbol
    self.to_sym == other
  when Integer
    self.to_i == other
  when Float
    self.to_f == other
  when Array
    self.to_a == other
  when Hash
    # false if self is not an assoc array
    self._value == other
  else
    # false
    self._value == _get_eval_string(other)
  end
end
            
===(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1266
def ===(other)
  if other.kind_of?(TkVariable)
    self.id == other.id
  else
    super
  end
end
            
=~(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1238
def =~(other)
  self._value =~ other
end
            
[](*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 686
def [](*idxs)
  _to_default_element_type(idxs, _element_value(*idxs))
end
            
[]=(*args) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 530
def []=(*args)
  val = args.pop
  type = default_element_value_type(args)
  val = val._value if !type && type != :variable && val.kind_of?(TkVariable)
  index = args.collect{|idx| _get_eval_string(idx, true)}.join(',')
  _fromUTF8(INTERP._set_global_var2(@id, index, _get_eval_string(val, true)))
  #_fromUTF8(INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(index)),
  #                                 _toUTF8(_get_eval_string(val))))
  #_fromUTF8(INTERP._set_global_var2(@id, _get_eval_string(index, true),
  #                                 _get_eval_string(val, true)))
end
            
bool() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 775
  def bool
    TkComm.bool(_value)
    # see Tcl_GetBoolean man-page
    case _value.downcase
    when '0', 'false', 'no', 'off'
      false
    else
      true
    end
  end
            
bool=(val) click to toggle source
Alias for: set_bool
bool_element(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 787
def bool_element(*idxs)
  TkComm.bool(_element_value(*idxs))
end
            
bool_type=(val) click to toggle source
Alias for: set_bool_type
clear() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 443
def clear
  if (is_scalar?)
    fail RuntimeError, 'cannot clear a scalar variable'
  end
  keys.each{|k| unset(k)}
  self
end
            
coerce(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1157
def coerce(other)
  case other
  when TkVariable
    [other._value, self._value]
  when String
    [other, self.to_s]
  when Symbol
    [other, self.to_sym]
  when Numeric
    [other, self.numeric]
  when Array
    [other, self.to_a]
  else
    [other, self._value]
  end
end
            
default_element_value_type(idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 149
def default_element_value_type(idxs)
  if idxs.kind_of?(Array)
    index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
  else
    index = _get_eval_string(idxs, true)
  end
  @element_type[index]
end
            
default_proc(cmd = Proc.new) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 134
def default_proc(cmd = Proc.new)
  @def_default = :proc
  @default_val = cmd
  self
end
            
default_value(val=nil, &b) click to toggle source

#default_value is available only when the variable is an assoc array.

 
               # File tk/lib/tk/variable.rb, line 118
def default_value(val=nil, &b)
  if b
    @def_default = :proc
    @default_val = proc(&b)
  else
    @def_default = :val
    @default_val = val
  end
  self
end
            
default_value=(val) click to toggle source
Alias for: set_default_value
default_value_type() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 146
def default_value_type
  @type
end
            
default_value_type=(type) click to toggle source
element_lappend(idxs, *elems) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1104
def element_lappend(idxs, *elems)
  if idxs.kind_of?(Array)
    idxs = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
  end
  tk_call('lappend', "#{@id}(#{idxs})", *elems)
  self
end
            
element_lget(elem_idxs, idx) click to toggle source
Alias for: element_lindex
element_lget_f(elem_idxs, idx) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1136
def element_lget_f(elem_idxs, idx)
  number(element_lget(elem_idxs, idx)).to_f
end
            
element_lget_i(elem_idxs, idx) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1129
def element_lget_i(elem_idxs, idx)
  number(element_lget(elem_idxs, idx)).to_i
end
            
element_lindex(elem_idxs, idx) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1116
def element_lindex(elem_idxs, idx)
  if elem_idxs.kind_of?(Array)
    val = _element_value(*elem_idxs)
  else
    val = _element_value(elem_idxs)
  end
  tk_call('lindex', val, idx)
end
            
Also aliased as: element_lget
element_lset(elem_idxs, idx, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1144
def element_lset(elem_idxs, idx, val)
  if elem_idxs.kind_of?(Array)
    idxs = elem_idxs.collect{|i| _get_eval_string(i, true)}.join(',')
  end
  tk_call('lset', "#{@id}(#{idxs})", idx, val)
  self
end
            
element_to_a(*idxs) click to toggle source
Alias for: list_element
element_to_f(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 951
def element_to_f(*idxs)
  number(_element_value(*idxs)).to_f
end
            
element_to_i(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 944
def element_to_i(*idxs)
  number(_element_value(*idxs)).to_i
end
            
element_to_s(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 961
def element_to_s(*idxs)
  _element_value(*idxs)
end
            
element_to_sym(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 997
def element_to_sym(*idxs)
  _element_value(*idxs).intern
end
            
Also aliased as: symbol_element
eventloop_tkwait() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 388
def eventloop_tkwait
  wait(false, true)
end
            
eventloop_wait(check_root = false) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 379
def eventloop_wait(check_root = false)
  wait(false, check_root)
end
            
exist?(*elems) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 415
def exist?(*elems)
  INTERP._invoke_without_enc('global', @id)
  if elems.empty?
    TkComm.bool(tk_call('info', 'exist', @id))
  else
    # array
    index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',')
    TkComm.bool(tk_call('info', 'exist', "#{@id}")) &&
      TkComm.bool(tk_call('info', 'exist', "#{@id}(#{index})"))
  end
end
            
id() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 395
def id
  @id
end
            
inspect() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1152
def inspect
  #Kernel.format "#<TkVariable: %s>", @id
  '#<TkVariable: ' + @id + '>'
end
            
is_hash?() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 404
def is_hash?
  #ITNERP._eval("global #{@id}; array exist #{@id}") == '1'
  INTERP._invoke_without_enc('global', @id)
  # INTERP._invoke_without_enc('array', 'exist', @id) == '1'
  TkComm.bool(INTERP._invoke_without_enc('array', 'exist', @id))
end
            
is_scalar?() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 411
def is_scalar?
  ! is_hash?
end
            
keys() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 427
def keys
  if (is_scalar?)
    fail RuntimeError, 'cannot get keys from a scalar variable'
  end
  #tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))
  INTERP._invoke_without_enc('global', @id)
  #tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'names', @id)))
  tk_split_simplelist(INTERP._invoke_without_enc('array', 'names', @id),
                      false, true)
end
            
lappend(*elems) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1100
def lappend(*elems)
  tk_call('lappend', @id, *elems)
  self
end
            
lget(idx) click to toggle source
Alias for: lindex
lget_f(idx) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1133
def lget_f(idx)
  number(lget(idx)).to_f
end
            
lget_i(idx) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1126
def lget_i(idx)
  number(lget(idx)).to_i
end
            
lindex(idx) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1112
def lindex(idx)
  tk_call('lindex', self._value, idx)
end
            
Also aliased as: lget
list() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1027
def list
  #tk_split_list(value)
  tk_split_simplelist(_value)
end
            
Also aliased as: to_a, to_ary
list=(val) click to toggle source
Alias for: set_list
list_element(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1033
def list_element(*idxs)
  tk_split_simplelist(_element_value(*idxs))
end
            
Also aliased as: element_to_a
list_type=(val) click to toggle source
Alias for: set_list_type
lset(idx, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1140
def lset(idx, val)
  tk_call('lset', @id, idx, val)
  self
end
            
mutex() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 22
def mutex; @mutex; end
            
nonzero?() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1277
def nonzero?
  !(numeric.zero?)
end
            
numeric() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 730
def numeric
  number(_value)
end
            
numeric=(val) click to toggle source
Alias for: set_numeric
numeric_element(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 733
def numeric_element(*idxs)
  number(_element_value(*idxs))
end
            
numeric_type=(val) click to toggle source
Alias for: set_numeric_type
numlist() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1038
def numlist
  list.collect!{|val| number(val)}
end
            
numlist=(val) click to toggle source
Alias for: set_numlist
numlist_element(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1041
def numlist_element(*idxs)
  list_element(*idxs).collect!{|val| number(val)}
end
            
numlist_type=(val) click to toggle source
Alias for: set_numlist_type
procedure() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 899
def procedure
  TkComm.procedure(self._value)
end
            
procedure=(cmd) click to toggle source
Alias for: set_procedure
procedure_element(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 902
def procedure_element(*idxs)
  TkComm.procedure(_element_value(*idxs))
end
            
procedure_type=(cmd) click to toggle source
Alias for: set_procedure_type
ref(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 399
def ref(*idxs)
  # "#{@id}(#{idxs.collect{|idx| _get_eval_string(idx)}.join(',')})"
  TkVarAccess.new("#{@id}(#{idxs.collect{|idx| _get_eval_string(idx)}.join(',')})")
end
            
remove(*elems) click to toggle source
Alias for: unset
set_bool(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 790
def set_bool(val)
  if ! val
    self.value = '0'
  else
    case val.to_s.downcase
    when 'false', '0', 'no', 'off'
      self.value = '0'
    else
      self.value = '1'
    end
  end
  self
end
            
Also aliased as: bool=
set_bool_element(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 804
def set_bool_element(idxs, val)
  if ! val
    val = '0'
  else
    case val.to_s.downcase
    when 'false', '0', 'no', 'off'
      val = '0'
    else
      val = '1'
    end
  end
  if idxs.kind_of?(Array)
    self[*idxs]=val
  else
    self[idxs]=val
  end
  self
end
            
set_bool_element_type(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 828
def set_bool_element_type(idxs, val)
  self.set_default_element_value_type(idxs, :bool)
  self.set_bool_element(idxs, val)
end
            
set_bool_type(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 822
def set_bool_type(val)
  @type = :bool
  self.bool=(val)
  self
end
            
Also aliased as: bool_type=
set_default_element_value_type(idxs, type) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 227
def set_default_element_value_type(idxs, type)
  _set_default_value_type_core(type, idxs)
  self
end
            
set_default_value(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 128
def set_default_value(val)
  @def_default = :val
  @default_val = val
  self
end
            
Also aliased as: default_value=
set_default_value_type(type) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 221
def set_default_value_type(type)
  _set_default_value_type_core(type, nil)
  self
end
            
Also aliased as: default_value_type=
set_element_value(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 703
def set_element_value(idxs, val)
  if idxs.kind_of?(Array)
    self[*idxs]=val
  else
    self[idxs]=val
  end
  self
end
            
set_element_value_type(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 720
def set_element_value_type(idxs, val)
  self.set_default_element_value_type(idxs, val.class)
  if idxs.kind_of?(Array)
    self[*idxs]=val
  else
    self[idxs]=val
  end
  self
end
            
set_list(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1045
def set_list(val)
  case val
  when Array
    self.value=(val)
  when TkVariable
    self.value=(val.list)
  else
    raise ArgumentError, "Array is expected"
  end
  self
end
            
Also aliased as: list=, set_numlist
set_list_element(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1061
def set_list_element(idxs, val)
  case val
  when Array
    val
  when TkVariable
    val = val.list
  else
    raise ArgumentError, "Array is expected"
  end
  if idxs.kind_of?(Array)
    self[*idxs]=val
  else
    self[idxs]=val
  end
  self
end
            
Also aliased as: set_numlist_element
set_list_element_type(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1085
def set_list_element_type(idxs, val)
  self.set_default_element_value_type(idxs, :list)
  self.set_list_element(idxs, val)
end
            
set_list_type(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1079
def set_list_type(val)
  @type = :list
  self.list=(val)
  self
end
            
Also aliased as: list_type=
set_numeric(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 736
def set_numeric(val)
  case val
  when Numeric
    self.value=(val)
  when TkVariable
    self.value=(val.numeric)
  else
    raise ArgumentError, "Numeric is expected"
  end
  self
end
            
Also aliased as: numeric=
set_numeric_element(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 748
def set_numeric_element(idxs, val)
  case val
  when Numeric
    val
  when TkVariable
    val = val.numeric
  else
    raise ArgumentError, "Numeric is expected"
  end
  if idxs.kind_of?(Array)
    self[*idxs]=val
  else
    self[idxs]=val
  end
  self
end
            
set_numeric_element_type(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 770
def set_numeric_element_type(idxs, val)
  self.set_default_element_value_type(idxs, :numeric)
  self.set_numeric_element(idxs, val)
end
            
set_numeric_type(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 764
def set_numeric_type(val)
  @type = :numeric
  self.numeric=(val)
  self
end
            
Also aliased as: numeric_type=
set_numlist(val) click to toggle source
Also aliased as: numlist=
Alias for: set_list
set_numlist_element(idxs, val) click to toggle source
Alias for: set_list_element
set_numlist_element_type(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1095
def set_numlist_element_type(idxs, val)
  self.set_default_element_value_type(idxs, :numlist)
  self.set_numlist_element(idxs, val)
end
            
set_numlist_type(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1089
def set_numlist_type(val)
  @type = :numlist
  self.numlist=(val)
  self
end
            
Also aliased as: numlist_type=
set_procedure(cmd) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 905
def set_procedure(cmd)
  self.value = cmd
  self
end
            
Also aliased as: procedure=
set_procedure_element(idxs, cmd) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 910
def set_procedure_element(idxs, cmd)
  cmd = cmd._value if cmd.kind_of?(TkVariable)
  if idxs.kind_of?(Array)
    self[*idxs]=cmd
  else
    self[idxs]=cmd
  end
  self
end
            
set_procedure_element_type(idxs, cmd) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 925
def set_procedure_element_type(idxs, cmd)
  self.set_default_element_value_type(idxs, :procedure)
  self.set_proceure_element(idxs, cmd)
end
            
set_procedure_type(cmd) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 919
def set_procedure_type(cmd)
  @type = :procedure
  self.procedure=(cmd)
  self
end
            
Also aliased as: procedure_type=
set_string(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 967
def set_string(val)
  val = val._value if val.kind_of?(TkVariable)
  self.value=val
  self
end
            
Also aliased as: string=
set_string_element(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 973
def set_string_element(idxs, val)
  val = val._value if val.kind_of?(TkVariable)
  if idxs.kind_of?(Array)
    self[*idxs]=val
  else
    self[idxs]=val
  end
  self
end
            
set_string_element_type(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 988
def set_string_element_type(idxs, val)
  self.set_default_element_value_type(idxs, :string)
  self.set_string_element(idxs, val)
end
            
set_string_type(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 982
def set_string_type(val)
  @type = :string
  self.string=(val)
  self
end
            
Also aliased as: string_type=
set_symbol(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1001
def set_symbol(val)
  val = val._value if val.kind_of?(TkVariable)
  self.value=val
  self
end
            
Also aliased as: symbol=
set_symbol_element(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1007
def set_symbol_element(idxs, val)
  val = val._value if val.kind_of?(TkVariable)
  if idxs.kind_of?(Array)
    self[*idxs]=val
  else
    self[idxs]=val
  end
  self
end
            
set_symbol_element_type(idxs, val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1022
def set_symbol_element_type(idxs, val)
  self.set_default_element_value_type(idxs, :symbol)
  self.set_symbol_element(idxs, val)
end
            
set_symbol_type(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1016
def set_symbol_type(val)
  @type = :symbol
  self.value=(val)
  self
end
            
Also aliased as: symbol_type=
set_value(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 690
def set_value(val)
  self.value = val
  self
end
            
set_value_type(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 712
def set_value_type(val)
  self.default_value_type = val.class
  self.value = val
  self
end
            
Also aliased as: value_type=
set_variable(var) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 840
def set_variable(var)
  var = var.id if var.kind_of?(TkVariable)
  self.value = var
  self
end
            
Also aliased as: variable=
set_variable_element(idxs, var) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 846
def set_variable_element(idxs, var)
  var = var.id if var.kind_of?(TkVariable)
  if idxs.kind_of?(Array)
    self[*idxs]=var
  else
    self[idxs]=var
  end
  self
end
            
set_variable_element_type(idxs, var) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 862
def set_variable_element_type(idxs, var)
  self.set_default_element_value_type(idxs, :variable)
  self.set_variable_element(idxs, var)
end
            
set_variable_type(var) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 855
def set_variable_type(var)
  @type = :variable
  var = var.id if var.kind_of?(TkVariable)
  self.value = var
  self
end
            
Also aliased as: variable_type=
set_window(win) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 873
def set_window(win)
  win = win._value if win.kind_of?(TkVariable)
  self.value = win
  self
end
            
Also aliased as: window=
set_window_element(idxs, win) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 879
def set_window_element(idxs, win)
  win = win._value if win.kind_of?(TkVariable)
  if idxs.kind_of?(Array)
    self[*idxs]=win
  else
    self[idxs]=win
  end
  self
end
            
set_window_element_type(idxs, win) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 894
def set_window_element_type(idxs, win)
  self.set_default_element_value_type(idxs, :window)
  self.set_window_element(idxs, win)
end
            
set_window_type(win) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 888
def set_window_type(win)
  @type = :window
  self.window=(win)
  self
end
            
Also aliased as: window_type=
size() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 438
def size
  INTERP._invoke_without_enc('global', @id)
  TkComm.number(INTERP._invoke_without_enc('array', 'size', @id))
end
            
string() click to toggle source
Alias for: to_s
string=(val) click to toggle source
Alias for: set_string
string_element(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 964
def string_element(*idxs)
  _element_value(*idxs)
end
            
string_type=(val) click to toggle source
Alias for: set_string_type
symbol() click to toggle source
Alias for: to_sym
symbol=(val) click to toggle source
Alias for: set_symbol
symbol_element(*idxs) click to toggle source
Alias for: element_to_sym
symbol_type=(val) click to toggle source
Alias for: set_symbol_type
thread_tkwait() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 391
def thread_tkwait
  wait(true, true)
end
            
thread_wait(check_root = false) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 382
def thread_wait(check_root = false)
  wait(true, check_root)
end
            
tkwait(on_thread = true) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 385
def tkwait(on_thread = true)
  wait(on_thread, true)
end
            
to_a() click to toggle source
Alias for: list
to_ary() click to toggle source
Alias for: list
to_eval() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1302
def to_eval
  @id
end
            
to_f() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 948
def to_f
  number(_value).to_f
end
            
to_hash() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 695
def to_hash
  hash = {}
  self.keys.each{|k|
    hash[k] = self[k]
  }
  hash
end
            
to_i() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 940
def to_i
  number(_value).to_i
end
            
Also aliased as: to_int
to_int() click to toggle source
Alias for: to_i
to_proc() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 930
def to_proc
  cmd = self.procedure
  if cmd.respond_to?(:call)
    cmd
  else
    # cmd is a String
    cmd.to_sym.to_proc
  end
end
            
to_s() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 955
def to_s
  #string(value).to_s
  _value
end
            
Also aliased as: string, to_str
to_str() click to toggle source
Alias for: to_s
to_sym() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 993
def to_sym
  _value.intern
end
            
Also aliased as: symbol
trace(opts, cmd = Proc.new) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1375
def trace(opts, cmd = Proc.new)
  opts = _check_trace_opt(opts)
  (@trace_var ||= []).unshift([opts,cmd])

  if @trace_opts == nil
    TkVar_CB_TBL[@id] = self
    @trace_opts = opts.dup
    if USE_OLD_TRACE_OPTION_STYLE
      Tk.tk_call_without_enc('trace', 'variable',
                             @id, @trace_opts, 'rb_var ' << @id)
    else
      Tk.tk_call_without_enc('trace', 'add', 'variable',
                             @id, @trace_opts, 'rb_var ' << @id)
    end
  else
    newopts = @trace_opts.dup
    if USE_OLD_TRACE_OPTION_STYLE
      opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
      if newopts != @trace_opts
        Tk.tk_call_without_enc('trace', 'vdelete',
                               @id, @trace_opts, 'rb_var ' << @id)
        @trace_opts.replace(newopts)
        Tk.tk_call_without_enc('trace', 'variable',
                               @id, @trace_opts, 'rb_var ' << @id)
      end
    else
      newopts |= opts
      unless (newopts - @trace_opts).empty?
        Tk.tk_call_without_enc('trace', 'remove', 'variable',
                               @id, @trace_opts, 'rb_var ' << @id)
        @trace_opts.replace(newopts)
        Tk.tk_call_without_enc('trace', 'add', 'variable',
                               @id, @trace_opts, 'rb_var ' << @id)
      end
    end
  end

  self
end
            
trace_callback(elem, op) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1306
def trace_callback(elem, op)
  if @trace_var.kind_of? Array
    @trace_var.each{|m,e| e.call(self,elem,op) if m.index(op)}
  end
  if elem.kind_of?(String) && elem != ''
    if @trace_elem.kind_of?(Hash) && @trace_elem[elem].kind_of?(Array)
      @trace_elem[elem].each{|m,e| e.call(self,elem,op) if m.index(op)}
    end
  end
end
            
trace_delete(opts,cmd) click to toggle source
Alias for: trace_remove
trace_delete_for_element(elem,opts,cmd) click to toggle source
trace_element(elem, opts, cmd = Proc.new) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1415
def trace_element(elem, opts, cmd = Proc.new)
  if @elem
    fail(RuntimeError,
         "invalid for a TkVariable which denotes an element of Tcl's array")
  end

  opts = _check_trace_opt(opts)

  ((@trace_elem ||= {})[elem] ||= []).unshift([opts,cmd])

  if @trace_opts == nil
    TkVar_CB_TBL[@id] = self
    @trace_opts = opts.dup
    if USE_OLD_TRACE_OPTION_STYLE
      Tk.tk_call_without_enc('trace', 'add', 'variable',
                             @id, @trace_opts, 'rb_var ' << @id)
    else
      Tk.tk_call_without_enc('trace', 'variable',
                             @id, @trace_opts, 'rb_var ' << @id)
    end
  else
    newopts = @trace_opts.dup
    if USE_OLD_TRACE_OPTION_STYLE
      opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
      if newopts != @trace_opts
        Tk.tk_call_without_enc('trace', 'vdelete',
                               @id, @trace_opts, 'rb_var ' << @id)
        @trace_opts.replace(newopts)
        Tk.tk_call_without_enc('trace', 'variable',
                               @id, @trace_opts, 'rb_var ' << @id)
      end
    else
      newopts |= opts
      unless (newopts - @trace_opts).empty?
        Tk.tk_call_without_enc('trace', 'remove', 'variable',
                               @id, @trace_opts, 'rb_var ' << @id)
        @trace_opts.replace(newopts)
        Tk.tk_call_without_enc('trace', 'add', 'variable',
                               @id, @trace_opts, 'rb_var ' << @id)
      end
    end
  end

  self
end
            
trace_info() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1461
def trace_info
  return [] unless @trace_var
  @trace_var.dup
end
            
Also aliased as: trace_vinfo
trace_info_for_element(elem) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1467
def trace_info_for_element(elem)
  if @elem
    fail(RuntimeError,
         "invalid for a TkVariable which denotes an element of Tcl's array")
  end
  return [] unless @trace_elem
  return [] unless @trace_elem[elem]
  @trace_elem[elem].dup
end
            
Also aliased as: trace_vinfo_for_element
trace_remove(opts,cmd) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1478
def trace_remove(opts,cmd)
  return self unless @trace_var.kind_of? Array

  opts = _check_trace_opt(opts)

  idx = -1
  if USE_OLD_TRACE_OPTION_STYLE
    newopts = ''
    @trace_var.each_with_index{|e, i|
      if idx < 0 && e[1] == cmd
        diff = false
        ['a', 'r', 'w', 'u'].each{|c|
          break if (diff = e[0].index(c) ^ opts.index(c))
        }
        unless diff
          #find
          idx = i
          next
        end
      end
      e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
    }
  else
    newopts = []
    @trace_var.each_with_index{|e, i|
      if idx < 0 && e[1] == cmd &&
          e[0].size == opts.size && (e[0] - opts).empty?
        # find
        idx = i
        next
      end
      newopts |= e[0]
    }
  end

  if idx >= 0
    @trace_var.delete_at(idx)
  else
    return self
  end

  (@trace_elem ||= {}).each{|elem|
    @trace_elem[elem].each{|e|
      if USE_OLD_TRACE_OPTION_STYLE
        e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
      else
        newopts |= e[0]
      end
    }
  }

  if USE_OLD_TRACE_OPTION_STYLE
    diff = false
    @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))}
    if diff
      Tk.tk_call_without_enc('trace', 'vdelete',
                             @id, @trace_opts, 'rb_var ' << @id)
      @trace_opts.replace(newopts)
      unless @trace_opts.empty?
        Tk.tk_call_without_enc('trace', 'variable',
                               @id, @trace_opts, 'rb_var ' << @id)
      end
    end
  else
    unless (@trace_opts - newopts).empty?
      Tk.tk_call_without_enc('trace', 'remove', 'variable',
                             @id, @trace_opts, 'rb_var ' << @id)
      @trace_opts.replace(newopts)
      unless @trace_opts.empty?
        Tk.tk_call_without_enc('trace', 'add', 'variable',
                               @id, @trace_opts, 'rb_var ' << @id)
      end
    end
  end

  self
end
            
Also aliased as: trace_delete, trace_vdelete
trace_remove_for_element(elem,opts,cmd) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1558
def trace_remove_for_element(elem,opts,cmd)
  if @elem
    fail(RuntimeError,
         "invalid for a TkVariable which denotes an element of Tcl's array")
  end
  return self unless @trace_elem.kind_of? Hash
  return self unless @trace_elem[elem].kind_of? Array

  opts = _check_trace_opt(opts)

  idx = -1
  if USE_OLD_TRACE_OPTION_STYLE
    @trace_elem[elem].each_with_index{|e, i|
      if idx < 0 && e[1] == cmd
        diff = false
        ['a', 'r', 'w', 'u'].each{|c|
          break if (diff = e[0].index(c) ^ opts.index(c))
        }
        unless diff
          #find
          idx = i
          next
        end
      end
    }
  else
    @trace_elem[elem].each_with_index{|e, i|
      if idx < 0 && e[1] == cmd &&
          e[0].size == opts.size && (e[0] - opts).empty?
        # find
        idx = i
        next
      end
    }
  end

  if idx >= 0
    @trace_elem[elem].delete_at(idx)
  else
    return self
  end

  if USE_OLD_TRACE_OPTION_STYLE
    newopts = ''
    @trace_var.each{|e|
      e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
    }
    @trace_elem.each{|elem|
      @trace_elem[elem].each{|e|
        e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
      }
    }
  else
    newopts = []
    @trace_var.each{|e|
      newopts |= e[0]
    }
    @trace_elem.each{|elem|
      @trace_elem[elem].each{|e|
        e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)}
      }
    }
  end

  if USE_OLD_TRACE_OPTION_STYLE
    diff = false
    @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))}
    if diff
      Tk.tk_call_without_enc('trace', 'vdelete',
                             @id, @trace_opts, 'rb_var ' << @id)
      @trace_opts.replace(newopts)
      unless @trace_opts.empty?
        Tk.tk_call_without_enc('trace', 'variable',
                               @id, @trace_opts, 'rb_var ' << @id)
      end
    end
  else
    unless (@trace_opts - newopts).empty?
      Tk.tk_call_without_enc('trace', 'remove', 'variable',
                             @id, @trace_opts, 'rb_var ' << @id)
      @trace_opts.replace(newopts)
      unless @trace_opts.empty?
        Tk.tk_call_without_enc('trace', 'add', 'variable',
                               @id, @trace_opts, 'rb_var ' << @id)
      end
    end
  end

  self
end
            
trace_vdelete(opts,cmd) click to toggle source
Alias for: trace_remove
trace_vdelete_for_element(elem,opts,cmd) click to toggle source
trace_vinfo() click to toggle source
Alias for: trace_info
trace_vinfo_for_element(elem) click to toggle source
undef_default() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 140
def undef_default
  @default_val = nil
  @def_default = false
  self
end
            
unset(*elems) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 542
def unset(*elems)
  if elems.empty?
    INTERP._unset_global_var(@id)
  else
    index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',')
    INTERP._unset_global_var2(@id, index)
  end
end
            
Also aliased as: remove, remove
update(hash) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 451
def update(hash)
  if (is_scalar?)
    fail RuntimeError, 'cannot update a scalar variable'
  end
  hash.each{|k,v| self[k] = v}
  self
end
            
value() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 682
def value
  _to_default_type(_value)
end
            
value=(val) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 480
  def value=(val)
    val = val._value if !@type && @type != :variable && val.kind_of?(TkVariable)
    if val.kind_of?(Hash)
      self.clear
      val.each{|k, v|
        #INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)),
        #                       _toUTF8(_get_eval_string(v)))
        INTERP._set_global_var2(@id, _get_eval_string(k, true),
                                _get_eval_string(v, true))
      }
      self.value
#    elsif val.kind_of?(Array)
      INTERP._set_global_var(@id, '')
      val.each{|v|
        #INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)),
        INTERP._set_variable(@id, _get_eval_string(v, true),
                             TclTkLib::VarAccessFlag::GLOBAL_ONLY   |
                             TclTkLib::VarAccessFlag::LEAVE_ERR_MSG |
                             TclTkLib::VarAccessFlag::APPEND_VALUE  |
                             TclTkLib::VarAccessFlag::LIST_ELEMENT)
      }
      self.value
#      _fromUTF8(INTERP._set_global_var(@id, array2tk_list(val, true)))
    else
      #_fromUTF8(INTERP._set_global_var(@id, _toUTF8(_get_eval_string(val))))
      _fromUTF8(INTERP._set_global_var(@id, _get_eval_string(val, true)))
    end
  end
            
value_type=(val) click to toggle source
Alias for: set_value_type
variable() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 833
def variable
  # keeps a Tcl's variable name
  TkVarAccess.new(self._value)
end
            
variable=(var) click to toggle source
Alias for: set_variable
variable_element(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 837
def variable_element(*idxs)
  TkVarAccess.new(_element_value(*idxs))
end
            
variable_type=(var) click to toggle source
Alias for: set_variable_type
wait(on_thread = false, check_root = false) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 363
def wait(on_thread = false, check_root = false)
  on_thread &= (Thread.list.size != 1)
  if on_thread
    if check_root
      INTERP._thread_tkwait('variable', @id)
    else
      INTERP._thread_vwait(@id)
    end
  else
    if check_root
      INTERP._invoke_without_enc('tkwait', 'variable', @id)
    else
      INTERP._invoke_without_enc('vwait', @id)
    end
  end
end
            
window() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 867
def window
  TkComm.window(self._value)
end
            
window=(win) click to toggle source
Alias for: set_window
window_element(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 870
def window_element(*idxs)
  TkComm.window(_element_value(*idxs))
end
            
window_type=(win) click to toggle source
Alias for: set_window_type
zero?() click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1274
def zero?
  numeric.zero?
end
            
|(other) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 1188
def |(other)
  if other.kind_of?(Array)
    self.to_a | other.to_a
  else
    self.to_i | other.to_i
  end
end
            

Protected Instance Methods

_element_value(*idxs) click to toggle source
 
               # File tk/lib/tk/variable.rb, line 511
def _element_value(*idxs)
  index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',')
  begin
    _fromUTF8(INTERP._get_global_var2(@id, index))
  rescue => e
    case @def_default
    when :proc
      @default_val.call(self, *idxs)
    when :val
      @default_val
    else
      fail e
    end
  end
  #_fromUTF8(INTERP._get_global_var2(@id, index))
  #_fromUTF8(INTERP._get_global_var2(@id, _toUTF8(_get_eval_string(index))))
  #_fromUTF8(INTERP._get_global_var2(@id, _get_eval_string(index, true)))
end
            
_value() click to toggle source

use Tcl function version of set tkvariable

 
               # File tk/lib/tk/variable.rb, line 468
def _value
  #if INTERP._eval("global #{@id}; array exist #{@id}") == '1'
  INTERP._invoke_without_enc('global', @id)
  # if INTERP._invoke('array', 'exist', @id) == '1'
  if TkComm.bool(INTERP._invoke('array', 'exist', @id))
    #Hash[*tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))]
    Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', @id))]
  else
    _fromUTF8(INTERP._get_global_var(@id))
  end
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.