Sha256: 0ffaee760a1e5cb0e47affc46df6ffe888844e4dcc88db9748e745f7282df24f

Contents?: true

Size: 472 Bytes

Versions: 52

Compression:

Stored size: 472 Bytes

Contents

# frozen_string_literal: true

module ElasticAPM
  # @api private
  module NaivelyHashable
    def naively_hashable?
      true
    end

    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
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
elastic-apm-3.6.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-3.5.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-3.4.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-3.3.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-3.2.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-3.1.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-3.0.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.12.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.11.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.10.1 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.10.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.9.1 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.9.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.8.1 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.8.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.7.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.6.1 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.6.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.5.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-2.4.0 lib/elastic_apm/naively_hashable.rb