discourse/lib/reviewable/collection.rb
Roman Rizzi 581d435d09
Revert "FEATURE: Let reviewables override the score type title. (#16234)" (#16238)
This reverts commit 746f8f37973eb775fbcb1d938d0438b019e6cee9.
2022-03-21 16:32:47 -03:00

42 lines
659 B
Ruby

# frozen_string_literal: true
class Reviewable < ActiveRecord::Base
class Collection
class Item
include ActiveModel::Serialization
attr_reader :id
def initialize(id)
@id = id
end
end
def initialize(reviewable, guardian, args = nil)
args ||= {}
@reviewable, @guardian, @args = reviewable, guardian, args
@content = []
end
def has?(id)
@content.any? { |a| a.id.to_s == id.to_s }
end
def blank?
@content.blank?
end
def present?
!blank?
end
def each
@content.each { |i| yield i }
end
def to_a
@content
end
end
end