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.



442
443
444
# File 'lib/new_relic/agent/new_relic_service.rb', line 442

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

Class Method Details

.is_supported?Boolean

Returns:

  • (Boolean)


469
470
471
# File 'lib/new_relic/agent/new_relic_service.rb', line 469

def self.is_supported?
  true
end

Instance Method Details

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



446
447
448
449
450
451
452
453
# File 'lib/new_relic/agent/new_relic_service.rb', line 446

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



465
466
467
# File 'lib/new_relic/agent/new_relic_service.rb', line 465

def format
  'pruby'
end

#load(data) ⇒ Object



455
456
457
458
459
460
461
462
463
# File 'lib/new_relic/agent/new_relic_service.rb', line 455

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