Class: Serialization::Simple::Serializer
- Inherits:
-
Object
- Object
- Serialization::Simple::Serializer
- Defined in:
- lib/rswim/serialization/simple/serializer.rb
Instance Method Summary collapse
-
#initialize(directory) ⇒ Serializer
constructor
A new instance of Serializer.
- #serialize(message) ⇒ Object
Constructor Details
#initialize(directory) ⇒ Serializer
Returns a new instance of Serializer.
6 7 8 |
# File 'lib/rswim/serialization/simple/serializer.rb', line 6 def initialize(directory) @directory = directory end |
Instance Method Details
#serialize(message) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rswim/serialization/simple/serializer.rb', line 10 def serialize() l1 = .type.to_s.gsub(/_/, '-') l1 << " #{@directory.host(.payload[:target_id])}" if .type == :ping_req .payload[:updates].to_a.each do |update| # host status incarnation_number l1 << "\n#{@directory.host(update.member_id)} #{update.status} #{update.incarnation_number}" l1 << " #{serialize_custom_state(update.custom_state)}" unless update.custom_state.empty? end l1 end |