Module: Rokaki::FilterModel
- Includes:
- Filterable
- Defined in:
- lib/rokaki/filter_model.rb,
lib/rokaki/filter_model/join_map.rb,
lib/rokaki/filter_model/like_keys.rb,
lib/rokaki/filter_model/basic_filter.rb,
lib/rokaki/filter_model/filter_chain.rb,
lib/rokaki/filter_model/nested_filter.rb,
lib/rokaki/filter_model/deep_assign_struct.rb,
lib/rokaki/filter_model/nested_like_filters.rb
Defined Under Namespace
Modules: ClassMethods
Classes: BasicFilter, DeepAssignStruct, FilterChain, JoinMap, LikeKeys, NestedFilter, NestedLikeFilters
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Filterable
#filters
Class Method Details
.included(base) ⇒ Object
6
7
8
|
# File 'lib/rokaki/filter_model.rb', line 6
def self.included(base)
base.extend(ClassMethods)
end
|
Instance Method Details
#prepare_terms(param, mode) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/rokaki/filter_model.rb', line 10
def prepare_terms(param, mode)
if Array === param
return param.map { |term| "%#{term}%" } if mode == :circumfix
return param.map { |term| "%#{term}" } if mode == :prefix
return param.map { |term| "#{term}%" } if mode == :suffix
else
return ["%#{param}%"] if mode == :circumfix
return ["%#{param}"] if mode == :prefix
return ["#{param}%"] if mode == :suffix
end
end
|