Skip to content

Commit 94fdc7d

Browse files
MONGOID-5415: Add splats to code docs (#5400)
* Correct splats in docs. * Requested fixes * Line wrap Co-authored-by: shields <[email protected]>
1 parent 68d200d commit 94fdc7d

File tree

28 files changed

+81
-76
lines changed

28 files changed

+81
-76
lines changed

lib/mongoid/association/accessors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def without_autobuild
251251
# @example Parse the args.
252252
# doc.parse_args(:name => "Joe")
253253
#
254-
# @param [ Array ] args The arguments.
254+
# @param [ Hash... ] *args The arguments.
255255
#
256256
# @return [ Array<Hash> ] The attributes and options.
257257
def parse_args(*args)

lib/mongoid/association/builders.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module Builders
2727
# @example Parse the args.
2828
# doc.parse_args(:name => "Joe")
2929
#
30-
# @param [ Array ] args The arguments.
30+
# @param [ Hash... ] *args The arguments.
3131
#
3232
# @return [ Array<Hash> ] The attributes and options.
3333
def parse_args(*args)

lib/mongoid/association/embedded/embeds_many/proxy.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Proxy < Association::Many
1919
# @example Push a document.
2020
# person.addresses.push(address)
2121
#
22-
# @param [ Document | Array<Document> ] args Any number of documents.
22+
# @param [ Document... ] *args Any number of documents.
2323
def <<(*args)
2424
docs = args.flatten
2525
return concat(docs) if docs.size > 1
@@ -117,7 +117,7 @@ def clear
117117
# @example Use #persisted? inside block to count persisted documents.
118118
# person.addresses.count { |a| a.persisted? && a.country == "FR" }
119119
#
120-
# @param [ Object | Array<Object> ] args Args to delegate to the target.
120+
# @param [ Object... ] *args Args to delegate to the target.
121121
#
122122
# @return [ Integer ] The total number of persisted embedded docs, as
123123
# flagged by the #persisted? method.
@@ -235,7 +235,7 @@ def exists?
235235
# @example Finds the first matching document using a block.
236236
# person.addresses.find { |addr| addr.state == 'CA' }
237237
#
238-
# @param [ Array<Object> ] args Various arguments.
238+
# @param [ Object... ] *args Various arguments.
239239
# @param [ Proc ] block Optional block to pass.
240240
#
241241
# @return [ Document | Array<Document> | nil ] A document or matching documents.
@@ -430,10 +430,10 @@ def integrate(document)
430430
# If the method exists on the array, use the default proxy behavior.
431431
#
432432
# @param [ Symbol | String ] name The name of the method.
433-
# @param [ Array ] args The method args
433+
# @param [ Object... ] *args The method args.
434434
# @param [ Proc ] block Optional block to pass.
435435
#
436-
# @return [ Criteria, Object ] A Criteria or return value from the target.
436+
# @return [ Criteria | Object ] A Criteria or return value from the target.
437437
ruby2_keywords def method_missing(name, *args, &block)
438438
return super if _target.respond_to?(name)
439439
klass.send(:with_scope, criteria) do

lib/mongoid/association/proxy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def characterize_one(document)
118118
# to the target of the proxy. This can be overridden in special cases.
119119
#
120120
# @param [ String | Symbol ] name The name of the method.
121-
# @param [ Array ] args The arguments passed to the method.
121+
# @param [ Object... ] *args The arguments passed to the method.
122122
ruby2_keywords def method_missing(name, *args, &block)
123123
_target.send(name, *args, &block)
124124
end

lib/mongoid/association/referenced/counter_cache.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module CounterCache
1313
# @example Reset the given counter cache
1414
# post.reset_counters(:comments)
1515
#
16-
# @param [ Symbol | Array ] counters One or more counter caches to reset
16+
# @param [ Symbol... ] *counters One or more counter caches to reset.
1717
def reset_counters(*counters)
1818
self.class.with(persistence_context) do |_class|
1919
_class.reset_counters(self, *counters)
@@ -30,7 +30,7 @@ module ClassMethods
3030
# Post.reset_counters('50e0edd97c71c17ea9000001', :comments)
3131
#
3232
# @param [ String ] id The id of the object that will be reset.
33-
# @param [ Symbol | Array ] counters One or more counter caches to reset
33+
# @param [ Symbol... ] *counters One or more counter caches to reset.
3434
def reset_counters(id, *counters)
3535
document = id.is_a?(Document) ? id : find(id)
3636
counters.each do |name|

lib/mongoid/association/referenced/has_and_belongs_to_many/proxy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Proxy < Referenced::HasMany::Proxy
2121
# @example Concat with other documents.
2222
# person.posts.concat([ post_one, post_two ])
2323
#
24-
# @param [ Document | Array<Document> ] args Any number of documents.
24+
# @param [ Document... ] *args Any number of documents.
2525
#
2626
# @return [ Array<Document> ] The loaded docs.
2727
def <<(*args)

lib/mongoid/association/referenced/has_many/enumerable.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ def empty?
215215
# completely depending on whether it is iterated to completion.
216216
#
217217
# This method can take a parameter and a block. The behavior with
218-
# either the paramater or the block is delegated to the standard
218+
# either the parameter or the block is delegated to the standard
219219
# library Enumerable module.
220220
#
221221
# Note that when Enumerable's any? method is invoked with both
222222
# a block and a pattern, it only uses the pattern.
223223
#
224-
# @param [ Object ] condition The condition that documents
224+
# @param [ Object... ] *args The condition that documents
225225
# must satisfy. See Enumerable documentation for details.
226226
#
227227
# @return [ true | false ] If the association has any documents.

lib/mongoid/association/referenced/has_many/proxy.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Proxy < Association::Many
2525
# @example Concat with other documents.
2626
# person.posts.concat([ post_one, post_two ])
2727
#
28-
# @param [ Document | Array<Document> ] args Any number of documents.
28+
# @param [ Document... ] *args Any number of documents.
2929
#
3030
# @return [ Array<Document> ] The loaded docs.
3131
def <<(*args)
@@ -199,7 +199,7 @@ def exists?
199199
# @note This will keep matching documents in memory for iteration
200200
# later.
201201
#
202-
# @param [ Object | Array<Object> ] *args The ids.
202+
# @param [ [ Object | Array<Object> ]... ] *args The ids.
203203
# @param [ Proc ] block Optional block to pass.
204204
#
205205
# @return [ Document | Array<Document> | nil ] A document or matching documents.
@@ -414,7 +414,7 @@ def cascade!(document)
414414
# If the method exists on the array, use the default proxy behavior.
415415
#
416416
# @param [ Symbol | String ] name The name of the method.
417-
# @param [ Array ] args The method args
417+
# @param [ Object... ] *args The method args
418418
# @param [ Proc ] block Optional block to pass.
419419
#
420420
# @return [ Criteria | Object ] A Criteria or return value from the target.

lib/mongoid/association/reflections.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def reflect_on_association(name)
2525
# @example Find multiple association metadata by macro.
2626
# person.reflect_on_all_associations(:embeds_many)
2727
#
28-
# @param [ Array<Symbol> ] macros The association macros.
28+
# @param [ Symbol... ] *macros The association macros.
2929
#
3030
# @return [ Array<Association> ] The matching association metadata.
3131
def reflect_on_all_association(*macros)
@@ -51,7 +51,7 @@ def reflect_on_association(name)
5151
# @example Find multiple association metadata by macro.
5252
# Person.reflect_on_all_associations(:embeds_many)
5353
#
54-
# @param [ Array<Symbol> ] macros The association macros.
54+
# @param [ Symbol... ] *macros The association macros.
5555
#
5656
# @return [ Array<Association> ] The matching association metadata.
5757
def reflect_on_all_associations(*macros)

lib/mongoid/attributes/dynamic.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def inspect_dynamic_fields
115115
# document.method_missing(:test)
116116
#
117117
# @param [ String | Symbol ] name The name of the method.
118-
# @param [ Array ] args The arguments to the method.
118+
# @param [ Object... ] *args The arguments to the method.
119119
#
120120
# @return [ Object ] The result of the method call.
121121
def method_missing(name, *args)

0 commit comments

Comments
 (0)