2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
|
# File 'lib/tk.rb', line 2057
def Tk.const_missing(sym)
case(sym)
when :TCL_LIBRARY
INTERP._invoke_without_enc('global', 'tcl_library')
INTERP._invoke("set", "tcl_library").freeze
when :TK_LIBRARY
INTERP._invoke_without_enc('global', 'tk_library')
INTERP._invoke("set", "tk_library").freeze
when :LIBRARY
INTERP._invoke("info", "library").freeze
when :PLATFORM, :TCL_PLATFORM
INTERP._invoke_without_enc('global', 'tcl_platform')
Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get',
'tcl_platform'))]
when :ENV
INTERP._invoke_without_enc('global', 'env')
Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', 'env'))]
when :AUTO_INDEX
INTERP._invoke_without_enc('global', 'auto_index')
Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', 'auto_index'))]
when :PRIV, :PRIVATE, :TK_PRIV
priv = {}
if INTERP._invoke_without_enc('info', 'vars', 'tk::Priv') != ""
var_nam = 'tk::Priv'
else
var_nam = 'tkPriv'
end
INTERP._invoke_without_enc('global', var_nam)
Hash[*tk_split_simplelist(INTERP._invoke('array', 'get',
var_nam))].each{|k,v|
k.freeze
case v
when /^-?\d+$/
priv[k] = v.to_i
when /^-?\d+\.?\d*(e[-+]?\d+)?$/
priv[k] = v.to_f
else
priv[k] = v.freeze
end
}
priv
else
raise NameError, 'uninitialized constant Tk::' + sym.id2name
end
end
|