class Druid::HavingOperator

Public Instance Methods

!() click to toggle source
# File lib/druid/having.rb, line 166
def !
  if @type == 'not'
    @elements.first
  else
    operator = HavingOperator.new(type: 'not')
    operator.havingSpec = self
    operator
  end
end
&(other) click to toggle source
# File lib/druid/having.rb, line 158
def &(other)
  apply_operator('and', other)
end
add(element) click to toggle source
# File lib/druid/having.rb, line 154
def add(element)
  @elements << element
end
and?() click to toggle source
# File lib/druid/having.rb, line 146
def and?
  @type == 'and'
end
|(other) click to toggle source
# File lib/druid/having.rb, line 162
def |(other)
  apply_operator('or', other)
end

Private Instance Methods

apply_operator(type, other) click to toggle source
# File lib/druid/having.rb, line 178
def apply_operator(type, other)
  if @type == type
    operator = self
  else
    operator = HavingOperator.new(type: type)
    operator.havingSpecs << self
  end
  operator.havingSpecs << other
  operator
end