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

#accept_visitor(visitor) ⇒ Object

delimiters



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

def accept_visitor(visitor)
  visitor.visit_boolean_clause(self)
end

#add(condition) ⇒ Object

conditions



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

def add(condition)
  conditions << condition
end

#buildObject



42
43
44
# File 'lib/elasticated/boolean_clause.rb', line 42

def build
  conditions.map &:build
end

#build_firstObject



46
47
48
# File 'lib/elasticated/boolean_clause.rb', line 46

def build_first
  conditions.first.build
end

#countObject



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

def count
  conditions.count
end

#delimitersObject



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

def delimiters
  conditions.map(&:delimiter)
end

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?
  count == 0
end

#fill_delimiter(field_delimiter) ⇒ Object



18
19
20
# File 'lib/elasticated/boolean_clause.rb', line 18

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