Module: NoBrainer::Criteria::Count

Extended by:
ActiveSupport::Concern
Defined in:
lib/no_brainer/criteria/count.rb

Instance Method Summary collapse

Instance Method Details

#any?Boolean

Returns:



12
13
14
15
16
17
18
# File 'lib/no_brainer/criteria/count.rb', line 12

def any?
  if block_given?
    to_a.any? { |*args| yield(*args) }
  else
    !empty?
  end
end

#countObject



4
5
6
# File 'lib/no_brainer/criteria/count.rb', line 4

def count
  run { without_ordering.without_plucking.to_rql.count }
end

#empty?Boolean

Returns:



8
9
10
# File 'lib/no_brainer/criteria/count.rb', line 8

def empty?
  count == 0
end