Sha256: e8094dc477fd37f10ab5b8798785c784fc9cfd47556486780b5ae4f58d713532

Contents?: true

Size: 1.05 KB

Versions: 32

Compression:

Stored size: 1.05 KB

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

module NewRelic
  module Agent
    class NewRelicService
      class Marshaller
        def prepare(data, options = {})
          encoder = options[:encoder] || default_encoder
          if data.respond_to?(:to_collector_array)
            data.to_collector_array(encoder)
          elsif data.kind_of?(Array)
            data.map { |element| prepare(element, options) }
          else
            data
          end
        end

        def default_encoder
          Encoders::Identity
        end

        def self.human_readable?
          false
        end

        protected

        def return_value(data)
          if data.respond_to?(:has_key?) && data.has_key?('return_value')
            data['return_value']
          else
            ::NewRelic::Agent.logger.debug("Unexpected response from collector: #{data}")
            nil
          end
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
newrelic_rpm-9.2.2 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-9.2.1 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-9.2.0 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-9.1.0 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-9.0.0 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-8.16.0 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-8.15.0 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-8.14.0 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-8.13.1 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-8.13.0 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-8.12.0 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-8.11.0 lib/new_relic/agent/new_relic_service/marshaller.rb