lib/mongoid/fields.rb in mongoid-8.0.1 vs lib/mongoid/fields.rb in mongoid-8.0.2
- old
+ new
@@ -145,11 +145,11 @@
# Apply all default values to the document which are not procs.
#
# @example Apply all the non-proc defaults.
# model.apply_pre_processed_defaults
#
- # @return [ Array<String ] The names of the non-proc defaults.
+ # @return [ Array<String> ] The names of the non-proc defaults.
def apply_pre_processed_defaults
pre_processed_defaults.each do |name|
apply_default(name)
end
end
@@ -157,11 +157,11 @@
# Apply all default values to the document which are procs.
#
# @example Apply all the proc defaults.
# model.apply_post_processed_defaults
#
- # @return [ Array<String ] The names of the proc defaults.
+ # @return [ Array<String> ] The names of the proc defaults.
def apply_post_processed_defaults
pending_callbacks.delete(:apply_post_processed_defaults)
post_processed_defaults.each do |name|
apply_default(name)
end
@@ -212,11 +212,11 @@
# Used in determining if the field is aliased or not.
#
# @example Get the database field name.
# model.database_field_name(:authorization)
#
- # @param [ String, Symbol ] name The name to get.
+ # @param [ String | Symbol ] name The name to get.
#
# @return [ String ] The name of the field as it's stored in the db.
def database_field_name(name)
self.class.database_field_name(name)
end
@@ -227,11 +227,11 @@
# doc.lazy_settable?(field, nil)
#
# @param [ Field ] field The field.
# @param [ Object ] value The current value.
#
- # @return [ true, false ] If we set the field lazily.
+ # @return [ true | false ] If we set the field lazily.
def lazy_settable?(field, value)
!frozen? && value.nil? && field.lazy?
end
# Is the document using object ids?
@@ -239,22 +239,22 @@
# @note Refactored from using delegate for class load performance.
#
# @example Is the document using object ids?
# model.using_object_ids?
#
- # @return [ true, false ] Using object ids.
+ # @return [ true | false ] Using object ids.
def using_object_ids?
self.class.using_object_ids?
end
# Does this field start with a dollar sign ($) or contain a dot/period (.)?
#
# @api private
#
# @param [ String ] name The field name.
#
- # @return [ true, false ] If this field is dotted or dollared.
+ # @return [ true | false ] If this field is dotted or dollared.
def dot_dollar_field?(name)
n = aliased_fields[name] || name
fields.key?(n) && (n.include?('.') || n.start_with?('$'))
end
@@ -394,11 +394,11 @@
# school._id
#
# If the belongs_to association is the last part of the name, we will
# pass back the _id field.
#
- # @param [ String, Symbol ] name The name to get.
+ # @param [ String | Symbol ] name The name to get.
# @param [ Hash ] relations The associations.
# @param [ Hash ] alaiased_fields The aliased fields.
# @param [ Hash ] alaiased_associations The aliased associations.
#
# @return [ String ] The name of the field as stored in the database.
@@ -453,11 +453,11 @@
end
# Get the name of the provided field as it is stored in the database.
# Used in determining if the field is aliased or not.
#
- # @param [ String, Symbol ] name The name to get.
+ # @param [ String | Symbol ] name The name to get.
#
# @return [ String ] The name of the field as it's stored in the db.
def database_field_name(name)
Fields.database_field_name(name, relations, aliased_fields, aliased_associations)
end
@@ -505,10 +505,10 @@
# our id.
#
# @example Does this class use object ids?
# person.using_object_ids?
#
- # @return [ true, false ] If the class uses BSON::ObjectIds for the id.
+ # @return [ true | false ] If the class uses BSON::ObjectIds for the id.
def using_object_ids?
fields["_id"].object_id_field?
end
# Traverse down the association tree and search for the field for the