Class: NewRelic::Agent::NewRelicService::Marshaller

Inherits:
Object
  • Object
show all
Defined in:
lib/new_relic/agent/new_relic_service/marshaller.rb

Direct Known Subclasses

JsonMarshaller

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.human_readable?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/new_relic/agent/new_relic_service/marshaller.rb', line 24

def self.human_readable?
  false
end

Instance Method Details

#default_encoderObject



20
21
22
# File 'lib/new_relic/agent/new_relic_service/marshaller.rb', line 20

def default_encoder
  Encoders::Identity
end

#prepare(data, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/new_relic/agent/new_relic_service/marshaller.rb', line 9

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