Module: Gum::Filters

Included in:
Search
Defined in:
lib/gum/filters.rb,
lib/gum/filters/geo.rb,
lib/gum/filters/term.rb,
lib/gum/filters/fuzzy.rb,
lib/gum/filters/range.rb,
lib/gum/filters/terms.rb,
lib/gum/filters/exists.rb,
lib/gum/filters/prefix.rb,
lib/gum/filters/regexp.rb,
lib/gum/filters/geo/bbox.rb,
lib/gum/filters/wildcard.rb,
lib/gum/filters/geo/range.rb,
lib/gum/filters/geo/distance.rb

Defined Under Namespace

Classes: Exists, Fuzzy, Geo, Prefix, Range, Regexp, Term, Terms, Wildcard

Class Method Summary collapse

Class Method Details

.define_filter(method, &block) ⇒ Object



27
28
29
# File 'lib/gum/filters.rb', line 27

def self.define_filter(method, &block)
  register method, Class.new(Gum::Filter, &block)
end

.register(method, klass = nil) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/gum/filters.rb', line 19

def self.register(method, klass = nil)
  define_method method do |*args|
    Factory.build(klass || method, args) do |filter|
      filters.push filter
    end
  end
end