debian-mirror-gitlab/app/serializers/group_serializer.rb

20 lines
395 B
Ruby
Raw Normal View History

2017-09-10 17:25:29 +05:30
class GroupSerializer < BaseSerializer
entity GroupEntity
def with_pagination(request, response)
tap { @paginator = Gitlab::Serializer::Pagination.new(request, response) }
end
def paginated?
@paginator.present?
end
def represent(resource, opts = {})
if paginated?
super(@paginator.paginate(resource), opts)
else
super(resource, opts)
end
end
end