Tk#array2tk_list bug?

F

Ferenc Engard

Hi all,

If I have the following Array: ["a","","b"], then I suppose that the
tk-ized version should be "a {} b" instead of "a b".

Shouldn't the Tk#array2tk_list around tk.rb's line 202 should be
something like this?

def array2tk_list(ary)
ary.collect{|e|
if e.kind_of? Array
"{#{array2tk_list(e)}}"
elsif e.kind_of? Hash
"{#{e.to_a.collect{|ee| array2tk_list(ee)}.join(' ')}}"
else
s = _get_eval_string(e)
# (s.index(/\s/))? "{#{s}}": s
# Instead:
(s.index(/\s/) or s.size==0)? "{#{s}}": s
end
}.join(" ")
end

Thanks,
Ferenc
 
H

Hidetoshi NAGAI

Hi,

From: Ferenc Engard <[email protected]>
Subject: Tk#array2tk_list bug?
Date: Sun, 30 Nov 2003 11:40:20 +0900
Message-ID: said:
Shouldn't the Tk#array2tk_list around tk.rb's line 202 should be
something like this?

Yes. You are right. Thank you for your report.
 
N

nobu.nokada

Hi,

At Sun, 30 Nov 2003 11:40:20 +0900,
Ferenc said:
# (s.index(/\s/))? "{#{s}}": s
# Instead:
(s.index(/\s/) or s.size==0)? "{#{s}}": s

(s.index(/\A\S+\z/)) ? "{#{s}}": s

might be fater, though not tested.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,815
Members
47,361
Latest member
RogerDuabe

Latest Threads

Top