Module: Mongoid::Criteria::Queryable::Extensions::String::ClassMethods
- Defined in:
- lib/mongoid/criteria/queryable/extensions/string.rb
Instance Method Summary collapse
-
#__expr_part__(key, value, negating = false) ⇒ Hash
Get the value as a expression.
-
#evolve(object) ⇒ String
Evolves the string into a MongoDB friendly value - in this case a string.
Instance Method Details
#__expr_part__(key, value, negating = false) ⇒ Hash
Get the value as a expression.
79 80 81 82 83 84 85 |
# File 'lib/mongoid/criteria/queryable/extensions/string.rb', line 79 def __expr_part__(key, value, negating = false) if negating { key => { "$#{__regexp?(value) ? 'not' : 'ne'}" => value } } else { key => value } end end |
#evolve(object) ⇒ String
Evolves the string into a MongoDB friendly value - in this case a string.
96 97 98 99 100 |
# File 'lib/mongoid/criteria/queryable/extensions/string.rb', line 96 def evolve(object) __evolve__(object) do |obj| __regexp?(obj) ? obj : obj.to_s end end |