lib/europeana/blacklight/response/pagination.rb in europeana-blacklight-1.1.0 vs lib/europeana/blacklight/response/pagination.rb in europeana-blacklight-1.2.0
- old
+ new
@@ -27,11 +27,17 @@
def model_name
return unless docs.present? && docs.first.respond_to?(:model_name)
docs.first.model_name
end
- def max_pages
- (defined?(@_max_pages) && @_max_pages) || (1000 / limit_value)
+ def max_pages(val = :none)
+ if val == :none
+ # getter
+ (defined?(@_max_pages) && @_max_pages) || (1000 / limit_value)
+ else
+ # setter
+ @_max_pages = val
+ end
end
def total_pages
total = super
total > max_pages ? max_pages : total