Module: Eson::Search::Filters
Defined Under Namespace
Modules: FilterMethods
Classes: FilterArray
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#filters ⇒ Object
Also known as:
filter
Returns the value of attribute filters.
29
30
31
|
# File 'lib/eson/search/filters.rb', line 29
def filters
@filters
end
|
Class Method Details
.register(name, klass) ⇒ Object
46
47
48
49
50
51
52
53
54
|
# File 'lib/eson/search/filters.rb', line 46
def self.register(name, klass)
FilterMethods.__send__(:define_method, name) do |*args, &block|
o = klass.new(*args)
o.context = :filter
o.args = self.args
o.instance_exec(o, &block) if block
filters << o
end
end
|
Instance Method Details
#filters? ⇒ Boolean
42
43
44
|
# File 'lib/eson/search/filters.rb', line 42
def filters?
@filters && !(@filters.empty?)
end
|
#to_query_hash ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/eson/search/filters.rb', line 56
def to_query_hash
others = super if defined?(super)
if filters?
{ :filter => filters.to_query_hash }.tap do |h|
h.merge!(others) if others
end
else
others
end
end
|