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

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/search_params.rb

Instance Method Summary collapse

Instance Method Details

#default_limitObject



48
49
50
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/search_params.rb', line 48

def default_limit
  100
end

#default_search_paramsObject

used for override



14
15
16
17
18
19
20
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/search_params.rb', line 14

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

#extra_paging_path_argsObject



52
53
54
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/search_params.rb', line 52

def extra_paging_path_args
  (vars = query_params) ? { query: vars } : {}
end

#paging_paramsObject



22
23
24
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/search_params.rb', line 22

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

#query_paramsObject



26
27
28
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/search_params.rb', line 26

def query_params
  (vars = params[:query]) ? Env.hash(vars) : {}
end

#search_keywordObject



39
40
41
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/search_params.rb', line 39

def search_keyword
  @search_keyword ||= term_param || search_vars&.dig(:keyword)
end

#search_paramsObject



9
10
11
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/search_params.rb', line 9

def search_params
  @search_params ||= default_search_params
end

#search_varsObject



43
44
45
46
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/search_params.rb', line 43

def search_vars
  # root.respond_to?(:search_params) ? root.search_params[:vars] :
  search_params[:vars]
end

#term_paramObject



35
36
37
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/search_params.rb', line 35

def term_param
  params[:term]
end

#type_paramObject



30
31
32
33
# File 'platypus/tmp/set/gem-defaults/mod009-search/abstract/0_search/search_params.rb', line 30

def type_param
  type = query_params[:type]
  type.present? && type
end