gitlab-org--gitlab-foss/app/serializers/base_serializer.rb

19 lines
363 B
Ruby
Raw Normal View History

2016-10-28 08:32:07 -04:00
class BaseSerializer
def initialize(parameters = {})
@request = EntityRequest.new(parameters)
2016-10-28 08:32:07 -04:00
end
def represent(resource, opts = {})
self.class.entity_class
.represent(resource, opts.merge(request: @request))
2016-10-28 08:32:07 -04:00
end
def self.entity(entity_class)
@entity_class ||= entity_class
end
def self.entity_class
@entity_class
end
end