Sha256: 0c9058e557f2b25aa1e670ea8d97bf58fbd56ff811f6730a4b44340aed254993

Contents?: true

Size: 1.03 KB

Versions: 11

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

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

11 entries across 11 versions & 1 rubygems

Version Path
newrelic_rpm-6.11.0.365 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-6.10.0.364 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-6.9.0.363 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-6.8.0.360 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-6.7.0.359 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-6.6.0.358 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-6.5.0.357 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-6.4.0.356 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-6.3.0.355 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-6.2.0.354 lib/new_relic/agent/new_relic_service/marshaller.rb
newrelic_rpm-6.1.0.352 lib/new_relic/agent/new_relic_service/marshaller.rb