1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Add new MarkerTimelinePresenter class

This commit is contained in:
Matt Jankowski 2024-02-05 09:34:51 -05:00
parent aa4d8987a0
commit c4f7b8b625

View file

@ -0,0 +1,23 @@
# frozen_string_literal: true
class MarkerTimelinePresenter
include ActiveModel::Model
alias read_attribute_for_serialization send
attr_reader :markers
def initialize(markers)
@markers = markers
end
Marker::TIMELINES.each do |timeline|
define_method timeline.to_sym do
markers.find { |marker| marker.timeline == timeline }
end
end
def timeline_present?(value)
markers.map(&:timeline).include?(value)
end
end