Module: Mongoid::Criteria::Queryable::Extensions::Symbol

Defined in:
build/mongoid-master/lib/mongoid/criteria/queryable/extensions/symbol.rb

Overview

This module contains additional symbol behavior.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#__expr_part__(value, negating = false) ⇒ Hash

Get the symbol as a specification.

Examples:

Get the symbol as a criteria.

:field.__expr_part__(value)

Parameters:

  • value (Object)

    The value of the criteria.

  • negating (true, false) (defaults to: false)

    If the selection should be negated.

Returns:

  • (Hash)

    The selection.

Since:

  • 1.0.0



23
24
25
# File 'build/mongoid-master/lib/mongoid/criteria/queryable/extensions/symbol.rb', line 23

def __expr_part__(value, negating = false)
  ::String.__expr_part__(self, value, negating)
end

#to_directionInteger

Get the symbol as a sort direction.

Examples:

Get the symbol as a sort direction.

"1".to_direction

Returns:

  • (Integer)

    The direction.

Since:

  • 1.0.0



35
36
37
# File 'build/mongoid-master/lib/mongoid/criteria/queryable/extensions/symbol.rb', line 35

def to_direction
  to_s.to_direction
end