Class: Elasticated::Conditions::NestedCondition

Inherits:
StandardCondition show all
Defined in:
lib/elasticated/conditions/nested_condition.rb

Instance Attribute Summary collapse

Attributes inherited from StandardCondition

#field, #opts

Instance Method Summary collapse

Methods inherited from StandardCondition

#fill_delimiter

Methods included from Mixins::Clonable

#==, #clone

Methods included from Mixins::Inspectionable

#inspect, #text_for_inspect

Constructor Details

#initialize(field, inner_conditions, opts = {}) ⇒ NestedCondition

Returns a new instance of NestedCondition.



7
8
9
10
# File 'lib/elasticated/conditions/nested_condition.rb', line 7

def initialize(field, inner_conditions, opts={})
  super(field, opts)
  self.inner_conditions = inner_conditions
end

Instance Attribute Details

#inner_conditionsObject

Returns the value of attribute inner_conditions.



5
6
7
# File 'lib/elasticated/conditions/nested_condition.rb', line 5

def inner_conditions
  @inner_conditions
end

Instance Method Details

#buildObject



12
13
14
15
# File 'lib/elasticated/conditions/nested_condition.rb', line 12

def build
  body = inner_conditions.build
  { nested: { path: field, filter: body }.merge(opts) }
end