Class: MarkMapper::Normalizers::CriteriaHashKey

Inherits:
Object
  • Object
show all
Defined in:
lib/mark_mapper/normalizers/criteria_hash_key.rb

Instance Method Summary collapse

Instance Method Details

#call(key) ⇒ Object

Public: Returns key normalized for MarkLogic

key - The key to normalize

Returns key as Symbol if possible, else key with no changes


9
10
11
12
13
14
# File 'lib/mark_mapper/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