Module: Predicate::Empty

Includes:
UnaryFunc
Defined in:
lib/predicate/nodes/empty.rb

Constant Summary

Constants included from Expr

Predicate::Expr::OP_NEGATIONS

Instance Method Summary collapse

Methods included from UnaryFunc

#free_variables, #operand, #priority

Methods included from Expr

#!, #&, #and_split, #attr_split, #bind, #constant_variables, #constants, #contradiction?, #dyadic_priority, #identifier?, #literal?, #opaque?, #qualify, #rename, #sexpr, #tautology?, #to_hash, #to_postgres, #to_s, #to_sequel, #unqualify, #|

Methods included from Factory

#_factor_predicate, #and, #comp, #contradiction, #empty, #from_hash, #h, #has_size, #identifier, #in, #literal, #match, #native, #not, #opaque, #or, #pg_array_empty, #pg_array_literal, #pg_array_overlaps, #placeholder, #qualified_identifier, #sexpr, #tautology, #var, #vars

Instance Method Details

#evaluate(tuple) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/predicate/nodes/empty.rb', line 5

def evaluate(tuple)
  value = operand.evaluate(tuple)
  unless value.respond_to?(:empty?)
    raise TypeError, "Expected #{value} to respond to empty?"
  end
  value.empty?
end