Module: Card::Set::Abstract::SearchParams::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod020-search/abstract/02_search_params.rb

Instance Method Summary collapse

Instance Method Details

#default_limitObject



38
39
40
# File 'tmpsets/set/mod020-search/abstract/02_search_params.rb', line 38

def default_limit
  100
end

#default_search_paramsObject

used for override



20
21
22
23
24
25
26
# File 'tmpsets/set/mod020-search/abstract/02_search_params.rb', line 20

def default_search_params
  if (qparams = query_params)
    paging_params.merge vars: qparams
  else
    paging_params
  end
end

#extra_paging_path_argsObject



42
43
44
45
46
# File 'tmpsets/set/mod020-search/abstract/02_search_params.rb', line 42

def extra_paging_path_args
  return {} unless (vars = query_params)

  { query: vars }
end

#offsetObject



11
12
13
# File 'tmpsets/set/mod020-search/abstract/02_search_params.rb', line 11

def offset
  search_params[:offset] || 0
end

#paging_paramsObject



28
29
30
# File 'tmpsets/set/mod020-search/abstract/02_search_params.rb', line 28

def paging_params
  { limit: limit_param, offset: offset_param }
end

#query_paramsObject



32
33
34
35
36
# File 'tmpsets/set/mod020-search/abstract/02_search_params.rb', line 32

def query_params
  return nil unless (vars = params[:query])

  Card.safe_param vars
end

#search_paramsObject



15
16
17
# File 'tmpsets/set/mod020-search/abstract/02_search_params.rb', line 15

def search_params
  @search_params ||= default_search_params
end