[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Tk#array2tk_list bug?

Ferenc Engard

11/30/2003 2:40:00 AM

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



2 Answers

Hidetoshi NAGAI

11/30/2003 8:41:00 AM

0

nobu.nokada

11/30/2003 8:59:00 AM

0

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