summaryrefslogtreecommitdiffstats
path: root/ext/tk/lib/tk.rb
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-04 14:21:24 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-04 14:21:24 +0000
commit9a3941a19127583bdcbf040668f3eafa08f435bd (patch)
tree38c8b734baa82fca6e5f8d8975af5afd50cafeef /ext/tk/lib/tk.rb
parentc9699cbe72f0d0e891f07dae57d6ada5199c0c38 (diff)
downloadruby-9a3941a19127583bdcbf040668f3eafa08f435bd.tar.gz
ruby-9a3941a19127583bdcbf040668f3eafa08f435bd.tar.xz
ruby-9a3941a19127583bdcbf040668f3eafa08f435bd.zip
* ext/tk/lib/tk.rb (TkComm#array2tk_list): accept enc-mode argument to
decide whether convert encoding of each element or not. * ext/tk/lib/tk/variable.rb (TkVariable#value=): fail to convert the encoding of array elements when assign an array to an TkVariable object. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk.rb')
-rw-r--r--ext/tk/lib/tk.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 500fa2153..77ca443cf 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -287,19 +287,19 @@ if USE_TCLs_LIST_FUNCTIONS
TkCore::INTERP._split_tklist(str)
end
- def array2tk_list(ary)
+ def array2tk_list(ary, enc=nil)
return "" if ary.size == 0
dst = ary.collect{|e|
if e.kind_of? Array
- array2tk_list(e)
+ array2tk_list(e, enc)
elsif e.kind_of? Hash
tmp_ary = []
#e.each{|k,v| tmp_ary << k << v }
e.each{|k,v| tmp_ary << "-#{_get_eval_string(k)}" << v }
- array2tk_list(tmp_ary)
+ array2tk_list(tmp_ary, enc)
else
- _get_eval_string(e)
+ _get_eval_string(e, enc)
end
}
TkCore::INTERP._merge_tklist(*dst)
@@ -422,16 +422,16 @@ else
list
end
- def array2tk_list(ary)
+ def array2tk_list(ary, enc=nil)
ary.collect{|e|
if e.kind_of? Array
- "{#{array2tk_list(e)}}"
+ "{#{array2tk_list(e, enc)}}"
elsif e.kind_of? Hash
# "{#{e.to_a.collect{|ee| array2tk_list(ee)}.join(' ')}}"
e.each{|k,v| tmp_ary << "-#{_get_eval_string(k)}" << v }
- array2tk_list(tmp_ary)
+ array2tk_list(tmp_ary, enc)
else
- s = _get_eval_string(e)
+ s = _get_eval_string(e, enc)
(s.index(/\s/) || s.size == 0)? "{#{s}}": s
end
}.join(" ")
@@ -3120,7 +3120,7 @@ module TkConfigMethod
when /^(#{__strval_optkeys.join('|')})$/
conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc(*(__confinfo_cmd << "-#{slot}"))))
+ conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}"))))
end
conf[__configinfo_struct[:key]] =
conf[__configinfo_struct[:key]][1..-1]