Module: Card::Set::Abstract::Paging::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod006-card-mod-collection/abstract/paging.rb,
card/tmpsets/set/mod005-card-mod-collection/abstract/paging.rb

Instance Method Summary collapse

Instance Method Details

#count_with_paramsObject



23
24
25
# File 'card/tmpsets/set/mod006-card-mod-collection/abstract/paging.rb', line 23

def count_with_params
  @count_with_params ||= card.item_names.count
end

#current_pageObject



32
33
34
# File 'card/tmpsets/set/mod006-card-mod-collection/abstract/paging.rb', line 32

def current_page
  (offset / limit).to_i
end

#extra_paging_path_argsObject

for override



37
38
39
# File 'card/tmpsets/set/mod006-card-mod-collection/abstract/paging.rb', line 37

def extra_paging_path_args
  {}
end

#limitObject



11
12
13
# File 'card/tmpsets/set/mod006-card-mod-collection/abstract/paging.rb', line 11

def limit
  @limit ||= contextual_param(:limit) || default_limit
end

#offsetObject



15
16
17
# File 'card/tmpsets/set/mod006-card-mod-collection/abstract/paging.rb', line 15

def offset
  @offset ||= contextual_param(:offset) || 0
end

#search_with_paramsObject



19
20
21
# File 'card/tmpsets/set/mod006-card-mod-collection/abstract/paging.rb', line 19

def search_with_params
  @search_with_params ||= card.item_names
end

#total_pagesObject



27
28
29
30
# File 'card/tmpsets/set/mod006-card-mod-collection/abstract/paging.rb', line 27

def total_pages
  return 1 if limit.zero?
  ((count_with_params - 1) / limit).to_i
end