Class: NoBrainer::Criteria::Where::UnaryOperator

Inherits:
Struct
  • Object
show all
Defined in:
lib/no_brainer/criteria/where.rb

Instance Method Summary collapse

Instance Method Details

#simplifyObject



253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/no_brainer/criteria/where.rb', line 253

def simplify
  simplified_clause = self.clause.simplify

  case simplified_clause
  when UnaryOperator then
    case [self.op, simplified_clause.op]
    when [:not, :not] then simplified_clause.clause
    else self.class.new(op, simplified_clause)
    end
  else self.class.new(op, simplified_clause)
  end
end

#to_rql(doc) ⇒ Object



266
267
268
269
270
# File 'lib/no_brainer/criteria/where.rb', line 266

def to_rql(doc)
  case op
  when :not then clause.to_rql(doc).not
  end
end