Class: OneApm::Support::Marshaller
- Inherits:
-
Object
- Object
- OneApm::Support::Marshaller
- Defined in:
- lib/one_apm/support/marshaller.rb
Direct Known Subclasses
Defined Under Namespace
Classes: CollectorError
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.human_readable? ⇒ Boolean
43 44 45 |
# File 'lib/one_apm/support/marshaller.rb', line 43 def self.human_readable? false end |
Instance Method Details
#default_encoder ⇒ Object
39 40 41 |
# File 'lib/one_apm/support/marshaller.rb', line 39 def default_encoder Encoders::Identity end |
#parsed_error(error) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/one_apm/support/marshaller.rb', line 10 def parsed_error(error) error_type = error['error_type'] = error['message'] exception = case error_type when 'OneApm::LicenseException' OneApm::LicenseException.new() when 'OneApm::ForceRestartException' OneApm::ForceRestartException.new() when 'OneApm::ForceDisconnectException' OneApm::ForceDisconnectException.new() else OneApm::Support::Marshaller::CollectorError.new("#{error['error_type']}: #{error['message']}") end exception end |
#prepare(data, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/one_apm/support/marshaller.rb', line 28 def prepare(data, ={}) encoder = [: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, ) } else data end end |