Mailinglist Archive: yast-devel (246 mails)
| < Previous | Next > |
[yast-devel] Re: [yast-commit] <rest-service> master : Revert "introduction to use dbus service"
- From: Klaus Kaempf <kkaempf@xxxxxxx>
- Date: Tue, 25 Aug 2009 17:18:38 +0200
- Message-id: <20090825151838.GB1262@xxxxxxxxxxxxx>
* Michal Zugec <mzugec@xxxxxxxxxxxxxxxxxxxxxxxxxx> [Aug 25. 2009 17:09]:
A couple of comments:
Why is the class called 'Network' and the variable 'dev' ?
The class should be either called NetworkDevice or embedded inside a
module (aka namespace), resulting in Network::Device
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.
Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx
A couple of comments:
+ ret = Scr.instance.execute(["/sbin/yast2", "lan", "list"])
+ lines = ret[:stderr].split "\n"
+ devices = []
+ lines.each do |s|
+ dev = Network.new
Why is the class called 'Network' and the variable 'dev' ?
The class should be either called NetworkDevice or embedded inside a
module (aka namespace), resulting in Network::Device
+ 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.
Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx
| < Previous | Next > |