[yast-devel] Re: [yast-commit] <rest-service> master : fix concerning limits
ref: refs/heads/master commit f90bd649630a76cb31629c7bd99d0b1d0aeabea3 Author: Stefan Schubert
Date: Fri Jul 17 10:23:16 2009 +0200 fix concerning limits --- plugins/status/app/models/status.rb | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/plugins/status/app/models/status.rb b/plugins/status/app/models/status.rb index 95136ea..a31ef24 100644 --- a/plugins/status/app/models/status.rb +++ b/plugins/status/app/models/status.rb @@ -164,7 +164,10 @@ class Status < ActiveRecord::Base
#setting the limits result.each do |key, value| - path = rrdfile.chomp(".rrd") + "/" + key + + path = rrdfile.chomp(".rrd") + path +="/" + key if key!="value" #do not take care about the value flag + path = path.tr('-','_') ^^^ Hint, ruby has for this purpose ! version of opration, so
Stefan Schubert napsal(a): path.tr!('-','_') is better (more DRY :)
if @limits.has_key?(path) result[key] ||= Hash.new result[key].merge!({"limit" => @limits[path] })
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Friday 17 July 2009 10:29:32 josef reidinger wrote:
+ + path = rrdfile.chomp(".rrd")
Also, while having the same effect, using this function gives more readability File.basename("foo.txt", ".txt") => "foo"
+ path +="/" + key if key!="value" #do not take care about the value flag + path = path.tr('-','_')
and again path + "/" + something should be File.join(..., ..., ...) Duncan -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (2)
-
Duncan Mac-Vicar P.
-
josef reidinger