Class: Maxwell::Agent::Host::Serializer
- Inherits:
-
Object
- Object
- Maxwell::Agent::Host::Serializer
show all
- Includes:
- Coercable
- Defined in:
- lib/maxwell/agent/host.rb
Class Method Summary
collapse
Methods included from Coercable
#coerce_value, #coerce_values!, included
Class Method Details
.deserialize(json) ⇒ Object
19
20
21
22
|
# File 'lib/maxwell/agent/host.rb', line 19
def self.deserialize(json)
hash = JSON.parse(json, symbolize_names: true)
Host.new(new.coerce_values!(hash))
end
|
.serialize(attrs) ⇒ Object
14
15
16
17
|
# File 'lib/maxwell/agent/host.rb', line 14
def self.serialize(attrs)
attrs.services = attrs.services.map(&:serialize)
JSON.dump attrs
end
|