Class: ContainerTagsSerializer

Inherits:
BaseSerializer show all
Defined in:
app/serializers/container_tags_serializer.rb

Instance Attribute Summary

Attributes inherited from BaseSerializer

#params

Instance Method Summary collapse

Methods inherited from BaseSerializer

entity, #initialize

Constructor Details

This class inherits a constructor from BaseSerializer

Instance Method Details

#paginated?Boolean

Returns:

  • (Boolean)

10
11
12
# File 'app/serializers/container_tags_serializer.rb', line 10

def paginated?
  @paginator.present?
end

#represent(resource, opts = {}) ⇒ Object


14
15
16
17
18
# File 'app/serializers/container_tags_serializer.rb', line 14

def represent(resource, opts = {})
  resource = @paginator.paginate(resource) if paginated?

  super(resource, opts)
end

#with_pagination(request, response) ⇒ Object


6
7
8
# File 'app/serializers/container_tags_serializer.rb', line 6

def with_pagination(request, response)
  tap { @paginator = Gitlab::Serializer::Pagination.new(request, response) }
end