Class: Elasticated::BooleanClause

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConditionsBuilder

#between, #boolean, #custom, #equal, #exists, #greater_equal, #greater_than, #less_equal, #less_than, #missing, #nested, #script, #wildcard, #with

Methods included from BlockEvaluation

#evaluate

Methods included from Clonable

#==, #clone

Constructor Details

#initializeBooleanClause

Returns a new instance of BooleanClause.



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

def initialize
  self.conditions = Array.new
end

Instance Attribute Details

#conditionsObject

Returns the value of attribute conditions.



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

def conditions
  @conditions
end

Instance Method Details

#add(condition) ⇒ Object

conditions



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

def add(condition)
  conditions << condition
end

#buildObject



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

def build
  conditions.map &:build
end

#build_firstObject



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

def build_first
  conditions.first.build
end

#countObject



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

def count
  conditions.count
end

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?
  count == 0
end

#fill_delimiter(field_delimiter) ⇒ Object

delimiters



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

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