Sha256: c1bd0efde9eb67d261f6fffd4e376b530b86527e18904fd7f1d026e3795692ee
Contents?: true
Size: 508 Bytes
Versions: 2
Compression:
Stored size: 508 Bytes
Contents
class Sysdig::AlertFilter def self.dump(hash) hash.map { |k,v| [k, normalize_condition(v).inspect].join(" = ") }.join(", ") end def self.load(hash_or_string) case hash_or_string when NilClass, Hash hash_or_string when String hash_or_string.split(", ").map { |t| t.split(" = ") }.inject({}) { |r,(k,c)| r.merge(k => normalize_condition(c)) } else nil end end def self.normalize_condition(string) string.gsub(/(^\\?\")|(\\?\"$)/, "") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sysdig-0.2.4 | lib/sysdig/alert_filter.rb |
sysdig-0.2.3 | lib/sysdig/alert_filter.rb |