Class: NewRelic::Agent::NewRelicService::PrubyMarshaller

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

Overview

Primitive Ruby Object Notation which complies JSON format data strutures

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Marshaller

#default_encoder, human_readable?, #parsed_error, #prepare

Constructor Details

#initializePrubyMarshaller

Returns a new instance of PrubyMarshaller.



389
390
391
# File 'lib/new_relic/agent/new_relic_service.rb', line 389

def initialize
  ::NewRelic::Agent.logger.debug 'Using Pruby marshaller'
end

Class Method Details

.is_supported?Boolean

Returns:

  • (Boolean)


416
417
418
# File 'lib/new_relic/agent/new_relic_service.rb', line 416

def self.is_supported?
  true
end

Instance Method Details

#dump(ruby, opts = {}) ⇒ Object



393
394
395
396
397
398
399
400
# File 'lib/new_relic/agent/new_relic_service.rb', line 393

def dump(ruby, opts={})
  NewRelic::LanguageSupport.with_cautious_gc do
    Marshal.dump(prepare(ruby, opts))
  end
rescue => e
  ::NewRelic::Agent.logger.debug("#{e.class.name} : #{e.message} when marshalling #{ruby.inspect}")
  raise
end

#formatObject



412
413
414
# File 'lib/new_relic/agent/new_relic_service.rb', line 412

def format
  'pruby'
end

#load(data) ⇒ Object



402
403
404
405
406
407
408
409
410
# File 'lib/new_relic/agent/new_relic_service.rb', line 402

def load(data)
  return unless data && data != ''
  NewRelic::LanguageSupport.with_cautious_gc do
    return_value(Marshal.load(data))
  end
rescue
  ::NewRelic::Agent.logger.debug "Error encountered loading collector response: #{data}"
  raise
end