Module: Eson::Search::Facets

Included in:
BaseQuery
Defined in:
lib/eson/search/facets.rb

Defined Under Namespace

Classes: FacetArray

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.register(name, klass) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/eson/search/facets.rb', line 22

def self.register(name, klass)
  FacetArray.__send__(:define_method, name) do |facet_name, *args, &block|
    o = klass.new(*args)
    o.args = self.args
    o.instance_exec(o, &block) if block
    self << [facet_name, o]
    o
  end
end

Instance Method Details

#facets(&block) ⇒ Object Also known as: facet



32
33
34
# File 'lib/eson/search/facets.rb', line 32

def facets(&block)
  @facets ||= FacetArray.new(args, &block)
end