Sha256: 3289206539de61861207054352b8a6378f2b5add447e7232818b3965287d6214
Contents?: true
Size: 972 Bytes
Versions: 13
Compression:
Stored size: 972 Bytes
Contents
# encoding: utf-8 module Origin # This is a smart hash for use with options and selectors. class Smash < Hash private # Get the normalized value for the key. If localization is in play the # current locale will be appended to the key in MongoDB dot notation. # # FIXME (Did). # This version DOES NOT USE ::I18n.locale directly. # See the localized.rb file for more explanation. # # @api private # # @example Get the normalized key name. # smash.normalized_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 normalized_key(name, serializer) # serializer && serializer.localized? ? "#{name}.#{::I18n.locale}" : name serializer && serializer.localized? ? "#{name}.#{::Mongoid::Fields::I18n.locale}" : name end end end
Version data entries
13 entries across 13 versions & 2 rubygems