Class: Rookout::Sanitizer

Inherits:
Object
  • Object
show all
Defined in:
lib/rookout/sanitizer.rb

Constant Summary collapse

@@blacklisted_properties =
Set["labels", "ROOKOUT_LABELS"]

Class Method Summary collapse

Class Method Details

.sanitize_object!(obj) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/rookout/sanitizer.rb', line 6

def self.sanitize_object! obj
  obj.each_key do |key|
    if obj[key].is_a?(String) && !@@blacklisted_properties.include?(key.to_s)
      obj[key] = obj[key].strip
    end
  end
end

.sanitize_properties!Object



14
15
16
17
18
19
20
# File 'lib/rookout/sanitizer.rb', line 14

def self.sanitize_properties!
  ENV.each do |key, val|
    if key.start_with?("ROOKOUT_") && !@@blacklisted_properties.include?(key.to_s)
      ENV[key] = val.strip.delete_suffix("/")
    end
  end
end