Method: ElasticAPM::NaivelyHashable#to_h

Defined in:
lib/elastic_apm/naively_hashable.rb

#to_hObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
31
32
33
34
35
36
37
# File 'lib/elastic_apm/naively_hashable.rb', line 28

def to_h
  instance_variables.each_with_object({}) do |name, h|
    key = name.to_s.delete('@').to_sym
    value = instance_variable_get(name)
    is_hashable =
      value.respond_to?(:naively_hashable?) && value.naively_hashable?

    h[key] = is_hashable ? value.to_h : value
  end
end