Class: Elasticated::BooleanClause

Inherits:
Object
  • Object
show all
Includes:
ConditionsBuilder, Mixins::Clonable, Mixins::Inspectionable
Defined in:
lib/elasticated/boolean_clause.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConditionsBuilder

#boolean, #custom, #exists, #greater_equal, #greater_than, #less_equal, #less_than, #missing, #nested, #now, #range, #script, #term, #terms, #wildcard, #with

Methods included from Mixins::BlockEvaluation

#evaluate

Methods included from Mixins::Inspectionable

#inspect, #text_for_inspect

Methods included from Mixins::Clonable

#==, #clone

Constructor Details

#initializeBooleanClause

Returns a new instance of BooleanClause.



9
10
11
# File 'lib/elasticated/boolean_clause.rb', line 9

def initialize
  self.conditions = Array.new
end

Instance Attribute Details

#conditionsObject

Returns the value of attribute conditions.



7
8
9
# File 'lib/elasticated/boolean_clause.rb', line 7

def conditions
  @conditions
end

Instance Method Details

#add(condition) ⇒ Object

conditions



21
22
23
# File 'lib/elasticated/boolean_clause.rb', line 21

def add(condition)
  conditions << condition
end

#buildObject



35
36
37
# File 'lib/elasticated/boolean_clause.rb', line 35

def build
  conditions.map &:build
end

#build_firstObject



39
40
41
# File 'lib/elasticated/boolean_clause.rb', line 39

def build_first
  conditions.first.build
end

#countObject



27
28
29
# File 'lib/elasticated/boolean_clause.rb', line 27

def count
  conditions.count
end

#empty?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/elasticated/boolean_clause.rb', line 31

def empty?
  count == 0
end

#fill_delimiter(field_delimiter) ⇒ Object

delimiters



15
16
17
# File 'lib/elasticated/boolean_clause.rb', line 15

def fill_delimiter(field_delimiter)
  conditions.each{ |condition| condition.fill_delimiter field_delimiter }
end