Add new `MarkerTimelineSerializer` class

This commit is contained in:
Matt Jankowski 2024-02-05 09:35:02 -05:00
parent dccde68649
commit 9d95ca7b0a
1 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class REST::MarkerTimelineSerializer < ActiveModel::Serializer
Marker::TIMELINES.each do |timeline|
has_one timeline.to_sym,
if: -> { timeline_present?(timeline) },
serializer: REST::MarkerSerializer
end
delegate :timeline_present?, to: :object
end