Module: Mongoid::Criteria::Queryable::Extensions::Symbol::ClassMethods
- Defined in:
- build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/symbol.rb
Instance Method Summary collapse
-
#add_key(name, strategy, operator, additional = nil, &block) ⇒ Object
Adds a method on symbol as a convenience for the MongoDB operator.
-
#evolve(object) ⇒ Symbol
Evolves the symbol into a MongoDB friendly value - in this case a symbol.
Instance Method Details
#add_key(name, strategy, operator, additional = nil, &block) ⇒ Object
Adds a method on symbol as a convenience for the MongoDB operator.
52 53 54 55 56 57 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/symbol.rb', line 52 def add_key(name, strategy, operator, additional = nil, &block) define_method(name) do method = "__#{strategy}__".to_sym Key.new(self, method, operator, additional, &block) end end |
#evolve(object) ⇒ Symbol
Evolves the symbol into a MongoDB friendly value - in this case a symbol.
70 71 72 |
# File 'build/mongoid-7.3/lib/mongoid/criteria/queryable/extensions/symbol.rb', line 70 def evolve(object) __evolve__(object) { |obj| obj.to_sym } end |