Module: Mongoid::Contextual::Aggregable::None
- Included in:
- None
- Defined in:
- lib/mongoid/contextual/aggregable/none.rb
Overview
Contains behavior for aggregating values in null context.
Instance Method Summary collapse
-
#aggregates(_field) ⇒ Hash
Get all the aggregate values for the provided field in null context.
-
#avg(_field) ⇒ nil
Always returns nil.
-
#min(_field = nil) ⇒ nil
(also: #max)
Always returns nil.
-
#sum(_field = nil) ⇒ Integer
Always returns zero.
Instance Method Details
#aggregates(_field) ⇒ Hash
Get all the aggregate values for the provided field in null context. Provided for interface consistency with Aggregable::Mongo.
18 19 20 |
# File 'lib/mongoid/contextual/aggregable/none.rb', line 18 def aggregates(_field) Aggregable::EMPTY_RESULT.dup end |
#avg(_field) ⇒ nil
Always returns nil.
40 41 42 |
# File 'lib/mongoid/contextual/aggregable/none.rb', line 40 def avg(_field) nil end |
#min(_field = nil) ⇒ nil Also known as: max
Always returns nil.
51 52 53 |
# File 'lib/mongoid/contextual/aggregable/none.rb', line 51 def min(_field = nil) nil end |
#sum(_field = nil) ⇒ Integer
Always returns zero.
29 30 31 |
# File 'lib/mongoid/contextual/aggregable/none.rb', line 29 def sum(_field = nil) 0 end |