Tk#array2tk_list bug?

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

Hi,

···

From: Ferenc Engard ferenc@engard.hu
Subject: Tk#array2tk_list bug?
Date: Sun, 30 Nov 2003 11:40:20 +0900
Message-ID: 3FC95892.7C6C761D@engard.hu

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.

                              Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Hi,

···

At Sun, 30 Nov 2003 11:40:20 +0900, Ferenc Engard wrote:

(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.


Nobu Nakada