Class: Recruiter::Filters::Base
- Inherits:
-
Object
- Object
- Recruiter::Filters::Base
show all
- Defined in:
- app/models/recruiter/filters.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/models/recruiter/filters.rb', line 18
def initialize(params = {})
init_query
params.each do |key, values|
method = "with_#{key}"
if respond_to?(method)
send(method, *values)
end
end
end
|
Instance Attribute Details
#query ⇒ Object
Returns the value of attribute query.
12
13
14
|
# File 'app/models/recruiter/filters.rb', line 12
def query
@query
end
|
Class Method Details
.filter(params = {}) ⇒ Object
14
15
16
|
# File 'app/models/recruiter/filters.rb', line 14
def self.filter(params = {})
new(params).filter
end
|
Instance Method Details
#filter ⇒ Object
33
34
35
|
# File 'app/models/recruiter/filters.rb', line 33
def filter
query
end
|
#init_query ⇒ Object
30
31
|
# File 'app/models/recruiter/filters.rb', line 30
def init_query
end
|
#merge(scope = nil, &block) ⇒ Object
37
38
39
40
41
|
# File 'app/models/recruiter/filters.rb', line 37
def merge(scope = nil, &block)
@query = query.merge(yield) if block_given?
@query = query.merge(scope) if scope
self
end
|