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-0.6.2 lib/elastic_apm/naively_hashable.rb
elastic-apm-0.6.1 lib/elastic_apm/naively_hashable.rb
elastic-apm-0.5.1 lib/elastic_apm/naively_hashable.rb
elastic-apm-0.5.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-0.4.5 lib/elastic_apm/naively_hashable.rb
elastic-apm-0.4.4 lib/elastic_apm/naively_hashable.rb
elastic-apm-0.4.3 lib/elastic_apm/naively_hashable.rb
elastic-apm-0.4.2 lib/elastic_apm/naively_hashable.rb
elastic-apm-0.4.1 lib/elastic_apm/naively_hashable.rb
elastic-apm-0.4.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-0.3.0 lib/elastic_apm/naively_hashable.rb
elastic-apm-0.2.0 lib/elastic_apm/naively_hashable.rb