Module: ElasticAPM::NaivelyHashable Private

Included in:
Stacktrace::Frame
Defined in:
lib/elastic_apm/naively_hashable.rb

Overview

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

TODO: Remove this?

Instance Method Summary collapse

Instance Method Details

#naively_hashable?Boolean

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.

Returns:

  • (Boolean)
[View source]

24
25
26
# File 'lib/elastic_apm/naively_hashable.rb', line 24

def naively_hashable?
  true
end

#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.

[View source]

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