26 Aug
2009
26 Aug
'09
11:09
On Tuesday 25 August 2009 17:18:38 Klaus Kaempf wrote:
* Michal Zugec
[Aug 25. 2009 17:09]: + dev.id = s.split("\t")[0] + dev.name = s.split("\t")[1]
Its more readable (and more Ruby like) to have id and name as 'constructor' arguments:
Network::Device.new id, name
And these assignments are wasting cycles as you're splitting the string two times.
dev.id, dev.name = s.split You can assign to several variables at once. Also split splits on any whitespace by default. Martin Kudlvasr
Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org