Sha256: 3605256ff1a514960e3dde24a2b9c8d84858f0ea1288e36e44e8bdc8411782ad
Contents?: true
Size: 913 Bytes
Versions: 3
Compression:
Stored size: 913 Bytes
Contents
# frozen_string_literal: true module Mongoid class Criteria module Queryable # This is a smart hash for use with options and selectors. class Smash < Hash private # Get the localized value for the key if needed. If the field uses # localization the current locale will be appended to the key in # MongoDB dot notation. # # @api private # # @example Get the normalized key name. # smash.localized_key("field", serializer) # # @param [ String ] name The name of the field. # @param [ Object ] serializer The optional field serializer. # # @return [ String ] The normalized key. # # @since 1.0.0 def localized_key(name, serializer) serializer&.localized? ? "#{name}.#{::Mongoid::Fields::I18n.locale}" : name end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems