[yast-devel] Re: [yast-commit] <rest-service> network : dns model shows xml list
On 09/03/2009 12:14 PM, Michal Zugec wrote:
ref: refs/heads/network commit b72baab724ea256472be56efe577c9231df97881 Author: Michal Zugec <mzugec@suse.cz> Date: Thu Sep 3 12:14:49 2009 +0200
dns model shows xml list --- plugins/network/app/models/dns.rb | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/plugins/network/app/models/dns.rb b/plugins/network/app/models/dns.rb index 6a03736..f153a75 100644 --- a/plugins/network/app/models/dns.rb +++ b/plugins/network/app/models/dns.rb @@ -42,9 +42,17 @@ class DNS xml = options[:builder] ||= Builder::XmlMarkup.new(options) xml.instruct! unless options[:skip_instruct]
- xml.hostname do - xml.domains @domains - xml.servers @servers + xml.dns do + xml.domains({:type => "array"}) do + domains.each do |@domains, val| + xml.tag!(:domain, domains) + end + end + xml.servers({:type => "array"}) do + servers.each do |@servers, val| + xml.tag!(:nameserver, servers) + end + end end end
Hi, I see it quite often in code and Karel on session say, that instead xml.tag!(:domain, domains) we should use simple xml.domain domains -- Josef Reidinger YaST team maintainer of perl-Bootloader, YaST2-Repair, webyast modules language and time -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
OK, we have attr_accessor :servers, which is apparently a hash. Still, WTF does the code mean?! Are you iterating over the keys only (what are the values for then?) and assigning the item to the same variable as the container?
+ xml.servers({:type => "array"}) do + servers.each do |@servers, val| + xml.tag!(:nameserver, servers) + end + end end end
-- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner
Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (2)
-
Josef Reidinger
-
Martin Vidner