lib/mongoid/serializable.rb in mongoid-8.0.1 vs lib/mongoid/serializable.rb in mongoid-8.0.2
- old
+ new
@@ -31,14 +31,18 @@
# @example Get the serializable hash with options.
# document.serializable_hash(:include => :addresses)
#
# @param [ Hash ] options The options to pass.
#
- # @option options [ Symbol ] :include What associations to include.
- # @option options [ Symbol ] :only Limit the fields to only these.
- # @option options [ Symbol ] :except Dont include these fields.
- # @option options [ Symbol ] :methods What methods to include.
+ # @option options [ Symbol | String | Array<Symbol | String> ] :except
+ # Do not include these field(s).
+ # @option options [ Symbol | String | Array<Symbol | String> ] :include
+ # Which association(s) to include.
+ # @option options [ Symbol | String | Array<Symbol | String> ] :only
+ # Limit the field(s) to only these.
+ # @option options [ Symbol | String | Array<Symbol | String> ] :methods
+ # What methods to include.
#
# @return [ Hash ] The document, ready to be serialized.
def serializable_hash(options = nil)
options ||= {}
attrs = {}
@@ -135,11 +139,11 @@
# provided as a convenience to parse out the names.
#
# @example Get the association names.
# document.relation_names(:include => [ :addresses ])
#
- # @param [ Hash, Symbol, Array<Symbol> ] inclusions The inclusions.
+ # @param [ Hash | Symbol | Array<Symbol> ] inclusions The inclusions.
#
# @return [ Array<Symbol> ] The names of the included associations.
def relation_names(inclusions)
inclusions.is_a?(Hash) ? inclusions.keys : Array.wrap(inclusions)
end
@@ -148,10 +152,10 @@
# provided as a convenience to parse out the options.
#
# @example Get the association options.
# document.relation_names(:include => [ :addresses ])
#
- # @param [ Hash, Symbol, Array<Symbol> ] inclusions The inclusions.
+ # @param [ Hash | Symbol | Array<Symbol> ] inclusions The inclusions.
# @param [ Hash ] options The options.
# @param [ Symbol ] name The name of the association.
#
# @return [ Hash ] The options for the association.
def relation_options(inclusions, options, name)