Class: Wor::Paginate::Formatters::PankoFormatter

Inherits:
Base
  • Object
show all
Defined in:
lib/wor/paginate/formatters/panko_formatter.rb

Instance Attribute Summary

Attributes inherited from Base

#adapter, #content, #formatter, #options

Instance Method Summary collapse

Methods inherited from Base

#format, #initialize

Methods included from Utils::UriHelper

query_params, replace_query_params

Constructor Details

This class inherits a constructor from Wor::Paginate::Formatters::Base

Instance Method Details

#serialized_contentObject



5
6
7
8
9
10
11
12
# File 'lib/wor/paginate/formatters/panko_formatter.rb', line 5

def serialized_content
  raise Wor::Paginate::Exceptions::DependencyError unless valid_serializer
  ActiveRecord::Base.transaction do
    Panko::ArraySerializer.new(paginated_content, each_serializer: serializer).to_a
  end
rescue ActiveRecord::StatementInvalid
  retry
end

#valid_serializerObject



14
15
16
# File 'lib/wor/paginate/formatters/panko_formatter.rb', line 14

def valid_serializer
  serializer.respond_to?('_descriptor') && defined?(Panko::Serializer)
end