ref: refs/heads/master
commit 3bdc44954f867999d83db2fe62ea92b2ef16ee75
Author: Josef Reidinger
Date: Tue Aug 4 09:53:47 2009 +0200
use lambdas instead loops
---
plugins/systemtime/lib/systemtime.rb | 24 ++++++------------------
1 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/plugins/systemtime/lib/systemtime.rb b/plugins/systemtime/lib/systemtime.rb
index 4b61e52..2c3fdd0 100644
--- a/plugins/systemtime/lib/systemtime.rb
+++ b/plugins/systemtime/lib/systemtime.rb
@@ -9,27 +9,15 @@ def fill_proxy_with_time(proxy,params)
end
def fill_proxy_with_timezone(proxy,params,timezones)
- region = {}
- timezones.each do |reg|
- if reg.name == params[:region]
- region = reg
- break
- end
- end
+ region = timezones.find { |reg| reg.name == params[:region] }
+ region = {} unless region
+
+ tmz = region.entries.find { |e| e.name == params[:timezone]}
+ proxy.timezone = tmz.id if tmz
- region.entries.each do |e|
- if (e.name == params[:timezone])
- proxy.timezone = e.id
- break
- end
- end
if (proxy.utcstatus != "UTConly")
- if params[:utc] == "true"
- proxy.utcstatus = "UTC"
- else
- proxy.utcstatus = "localtime"
- end
+ proxy.utcstatus = params[:utc] == "true" ? "UTC" : "localtime"
end
proxy.time = ""
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org