Class: Plucky::Normalizers::CriteriaHashKey
- Defined in:
- lib/plucky/normalizers/criteria_hash_key.rb
Instance Method Summary collapse
-
#call(key) ⇒ Object
Public: Returns key normalized for Mongo.
Instance Method Details
#call(key) ⇒ Object
Public: Returns key normalized for Mongo
key - The key to normalize
Returns key as Symbol if possible, else key with no changes
9 10 11 12 13 14 |
# File 'lib/plucky/normalizers/criteria_hash_key.rb', line 9 def call(key) key = key.to_sym if key.respond_to?(:to_sym) return call(key.field) if key.respond_to?(:field) return :_id if key == :id key end |