Class: Flipper::Notifications::EventSerializer

Inherits:
ActiveJob::Serializers::ObjectSerializer
  • Object
show all
Defined in:
lib/flipper/notifications/event_serializer.rb

Instance Method Summary collapse

Instance Method Details

#deserialize(hash) ⇒ Object



25
26
27
# File 'lib/flipper/notifications/event_serializer.rb', line 25

def deserialize(hash)
  FeatureEvent.new(**hash.symbolize_keys.slice(:feature_name, :operation))
end

#klassObject



10
11
12
# File 'lib/flipper/notifications/event_serializer.rb', line 10

def klass
  FeatureEvent
end

#serialize(event) ⇒ Object



18
19
20
21
22
23
# File 'lib/flipper/notifications/event_serializer.rb', line 18

def serialize(event)
  super(
    feature_name: event.feature.name,
    operation:    event.operation
  )
end

#serialize?(argument) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/flipper/notifications/event_serializer.rb', line 14

def serialize?(argument)
  argument.is_a?(FeatureEvent)
end