Module: NewRelic::Agent::EncodingNormalizer
- Defined in:
- lib/new_relic/agent/encoding_normalizer.rb
Defined Under Namespace
Modules: EncodingNormalizer
Class Method Summary
collapse
Class Method Details
.normalize_object(object) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/new_relic/agent/encoding_normalizer.rb', line 14
def self.normalize_object(object)
case object
when String
normalize_string(object)
when Symbol
normalize_string(object.to_s)
when Array
return object if object.empty?
object.map { |x| normalize_object(x) }
when Hash
return object if object.empty?
hash = {}
object.each_pair do |k, v|
k = normalize_string(k) if k.is_a?(String)
k = normalize_string(k.to_s) if k.is_a?(Symbol)
hash[k] = normalize_object(v)
end
hash
when Rational
object.to_f
else
object
end
end
|
.normalize_string(raw_string) ⇒ Object
10
11
12
|
# File 'lib/new_relic/agent/encoding_normalizer.rb', line 10
def self.normalize_string(raw_string)
EncodingNormalizer.normalize(raw_string)
end
|