Skip to content

Commit 4381cfd

Browse files
MONGOID-5640 Fix docstring issues (#5677)
1 parent 3e2c7fd commit 4381cfd

File tree

10 files changed

+41
-61
lines changed

10 files changed

+41
-61
lines changed

lib/mongoid/config/defaults.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Defaults
1111
# Note that this method will load the *new* functionality introduced in
1212
# the given Mongoid version.
1313
#
14-
# @param [ String | Float ] The version number as X.y.
14+
# @param [ String | Float ] version The version number as X.y.
1515
#
1616
# raises [ ArgumentError ] if an invalid version is given.
1717
def load_defaults(version)

lib/mongoid/contextual/memory.rb

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def first(limit = nil)
153153
#
154154
# @return [ Document ] The first document.
155155
#
156-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
156+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
157157
# documents to take.
158158
def first!
159159
first || raise_document_not_found_error
@@ -214,7 +214,7 @@ def last(limit = nil)
214214
#
215215
# @return [ Document ] The last document.
216216
#
217-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
217+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
218218
# documents to take.
219219
def last!
220220
last || raise_document_not_found_error
@@ -312,7 +312,7 @@ def take(limit = nil)
312312
#
313313
# @return [ Document ] The document.
314314
#
315-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
315+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
316316
# documents to take.
317317
def take!
318318
take || raise_document_not_found_error
@@ -373,8 +373,6 @@ def update_all(attributes = nil)
373373
# @example Get the second document.
374374
# context.second
375375
#
376-
# @param [ Integer ] limit The number of documents to return.
377-
#
378376
# @return [ Document ] The second document.
379377
def second
380378
eager_load([documents.second]).first
@@ -388,7 +386,7 @@ def second
388386
#
389387
# @return [ Document ] The second document.
390388
#
391-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
389+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
392390
# documents to take.
393391
def second!
394392
second || raise_document_not_found_error
@@ -399,8 +397,6 @@ def second!
399397
# @example Get the third document.
400398
# context.third
401399
#
402-
# @param [ Integer ] limit The number of documents to return.
403-
#
404400
# @return [ Document ] The third document.
405401
def third
406402
eager_load([documents.third]).first
@@ -414,7 +410,7 @@ def third
414410
#
415411
# @return [ Document ] The third document.
416412
#
417-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
413+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
418414
# documents to take.
419415
def third!
420416
third || raise_document_not_found_error
@@ -425,8 +421,6 @@ def third!
425421
# @example Get the fourth document.
426422
# context.fourth
427423
#
428-
# @param [ Integer ] limit The number of documents to return.
429-
#
430424
# @return [ Document ] The fourth document.
431425
def fourth
432426
eager_load([documents.fourth]).first
@@ -440,7 +434,7 @@ def fourth
440434
#
441435
# @return [ Document ] The fourth document.
442436
#
443-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
437+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
444438
# documents to take.
445439
def fourth!
446440
fourth || raise_document_not_found_error
@@ -451,8 +445,6 @@ def fourth!
451445
# @example Get the fifth document.
452446
# context.fifth
453447
#
454-
# @param [ Integer ] limit The number of documents to return.
455-
#
456448
# @return [ Document ] The fifth document.
457449
def fifth
458450
eager_load([documents.fifth]).first
@@ -466,7 +458,7 @@ def fifth
466458
#
467459
# @return [ Document ] The fifth document.
468460
#
469-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
461+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
470462
# documents to take.
471463
def fifth!
472464
fifth || raise_document_not_found_error
@@ -477,8 +469,6 @@ def fifth!
477469
# @example Get the second to last document.
478470
# context.second_to_last
479471
#
480-
# @param [ Integer ] limit The number of documents to return.
481-
#
482472
# @return [ Document ] The second to last document.
483473
def second_to_last
484474
eager_load([documents.second_to_last]).first
@@ -492,7 +482,7 @@ def second_to_last
492482
#
493483
# @return [ Document ] The second to last document.
494484
#
495-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
485+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
496486
# documents to take.
497487
def second_to_last!
498488
second_to_last || raise_document_not_found_error
@@ -503,8 +493,6 @@ def second_to_last!
503493
# @example Get the third to last document.
504494
# context.third_to_last
505495
#
506-
# @param [ Integer ] limit The number of documents to return.
507-
#
508496
# @return [ Document ] The third to last document.
509497
def third_to_last
510498
eager_load([documents.third_to_last]).first
@@ -518,7 +506,7 @@ def third_to_last
518506
#
519507
# @return [ Document ] The third to last document.
520508
#
521-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
509+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
522510
# documents to take.
523511
def third_to_last!
524512
third_to_last || raise_document_not_found_error

lib/mongoid/contextual/mongo.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def take(limit = nil)
402402
#
403403
# @return [ Document ] The document.
404404
#
405-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
405+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
406406
# documents to take.
407407
def take!
408408
# Do to_a first so that the Mongo#first method is not used and the
@@ -584,7 +584,7 @@ def first(limit = nil)
584584
#
585585
# @return [ Document ] The first document.
586586
#
587-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
587+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
588588
# documents available.
589589
def first!
590590
first || raise_document_not_found_error
@@ -626,7 +626,7 @@ def last(limit = nil)
626626
#
627627
# @return [ Document ] The last document.
628628
#
629-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
629+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
630630
# documents available.
631631
def last!
632632
last || raise_document_not_found_error
@@ -650,7 +650,7 @@ def second
650650
#
651651
# @return [ Document ] The second document.
652652
#
653-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
653+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
654654
# documents available.
655655
def second!
656656
second || raise_document_not_found_error
@@ -674,7 +674,7 @@ def third
674674
#
675675
# @return [ Document ] The third document.
676676
#
677-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
677+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
678678
# documents available.
679679
def third!
680680
third || raise_document_not_found_error
@@ -698,7 +698,7 @@ def fourth
698698
#
699699
# @return [ Document ] The fourth document.
700700
#
701-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
701+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
702702
# documents available.
703703
def fourth!
704704
fourth || raise_document_not_found_error
@@ -722,7 +722,7 @@ def fifth
722722
#
723723
# @return [ Document ] The fifth document.
724724
#
725-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
725+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
726726
# documents available.
727727
def fifth!
728728
fifth || raise_document_not_found_error
@@ -748,7 +748,7 @@ def second_to_last
748748
#
749749
# @return [ Document ] The second to last document.
750750
#
751-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
751+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
752752
# documents available.
753753
def second_to_last!
754754
second_to_last || raise_document_not_found_error
@@ -774,7 +774,7 @@ def third_to_last
774774
#
775775
# @return [ Document ] The third to last document.
776776
#
777-
# @raises [ Mongoid::Errors::DocumentNotFound ] raises when there are no
777+
# @raise [ Mongoid::Errors::DocumentNotFound ] raises when there are no
778778
# documents available.
779779
def third_to_last!
780780
third_to_last || raise_document_not_found_error

lib/mongoid/contextual/mongo/documents_loader.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ def self.executor(name = Mongoid.async_query_executor)
8282
# @param [ Class ] klass Mongoid model class to instantiate documents.
8383
# All records obtained from the database will be converted to an
8484
# instance of this class, if possible.
85-
# @param [ Mongoid::Criteria ] criteria. Criteria that specifies which
85+
# @param [ Mongoid::Criteria ] criteria Criteria that specifies which
8686
# documents should be loaded.
87-
# @param [ Concurrent::AbstractExecutorService ] executor. Executor that
87+
# @param [ Concurrent::AbstractExecutorService ] executor Executor that
8888
# is capable of running `Concurrent::Promises::Future` instances.
8989
def initialize(view, klass, criteria, executor: self.class.executor)
9090
@view = view

lib/mongoid/contextual/none.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def first(limit = nil)
134134
# @example Get the first document in null context.
135135
# context.first!
136136
#
137-
# @raises [ Mongoid::Errors::DocumentNotFound ] always raises.
137+
# @raise [ Mongoid::Errors::DocumentNotFound ] always raises.
138138
def first!
139139
raise_document_not_found_error
140140
end
@@ -156,7 +156,7 @@ def last(limit = nil)
156156
# @example Get the last document in null context.
157157
# context.last!
158158
#
159-
# @raises [ Mongoid::Errors::DocumentNotFound ] always raises.
159+
# @raise [ Mongoid::Errors::DocumentNotFound ] always raises.
160160
def last!
161161
raise_document_not_found_error
162162
end
@@ -178,7 +178,7 @@ def take(limit = nil)
178178
# @example Take a document in null context.
179179
# context.take!
180180
#
181-
# @raises [ Mongoid::Errors::DocumentNotFound ] always raises.
181+
# @raise [ Mongoid::Errors::DocumentNotFound ] always raises.
182182
def take!
183183
raise_document_not_found_error
184184
end
@@ -198,7 +198,7 @@ def second
198198
# @example Get the second document in null context.
199199
# context.second!
200200
#
201-
# @raises [ Mongoid::Errors::DocumentNotFound ] always raises.
201+
# @raise [ Mongoid::Errors::DocumentNotFound ] always raises.
202202
def second!
203203
raise_document_not_found_error
204204
end
@@ -218,7 +218,7 @@ def third
218218
# @example Get the third document in null context.
219219
# context.third!
220220
#
221-
# @raises [ Mongoid::Errors::DocumentNotFound ] always raises.
221+
# @raise [ Mongoid::Errors::DocumentNotFound ] always raises.
222222
def third!
223223
raise_document_not_found_error
224224
end
@@ -238,7 +238,7 @@ def fourth
238238
# @example Get the fourth document in null context.
239239
# context.fourth!
240240
#
241-
# @raises [ Mongoid::Errors::DocumentNotFound ] always raises.
241+
# @raise [ Mongoid::Errors::DocumentNotFound ] always raises.
242242
def fourth!
243243
raise_document_not_found_error
244244
end
@@ -258,7 +258,7 @@ def fifth
258258
# @example Get the fifth document in null context.
259259
# context.fifth!
260260
#
261-
# @raises [ Mongoid::Errors::DocumentNotFound ] always raises.
261+
# @raise [ Mongoid::Errors::DocumentNotFound ] always raises.
262262
def fifth!
263263
raise_document_not_found_error
264264
end
@@ -278,7 +278,7 @@ def second_to_last
278278
# @example Get the second to last document in null context.
279279
# context.second_to_last!
280280
#
281-
# @raises [ Mongoid::Errors::DocumentNotFound ] always raises.
281+
# @raise [ Mongoid::Errors::DocumentNotFound ] always raises.
282282
def second_to_last!
283283
raise_document_not_found_error
284284
end
@@ -298,7 +298,7 @@ def third_to_last
298298
# @example Get the third to last document in null context.
299299
# context.third_to_last!
300300
#
301-
# @raises [ Mongoid::Errors::DocumentNotFound ] always raises.
301+
# @raise [ Mongoid::Errors::DocumentNotFound ] always raises.
302302
def third_to_last!
303303
raise_document_not_found_error
304304
end

lib/mongoid/criteria/queryable/storable.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def add_field_expression(field, value)
8383
#
8484
# {'$or' => [{'hello' => 'world'}]}
8585
#
86-
# ... and operator is '$or' and op_expr is `[{'test' => 123'}]`,
86+
# ... and operator is '$or' and op_expr is +[{'test' => 123'}]+,
8787
# the resulting selector will be:
8888
#
8989
# {'$or' => [{'hello' => 'world'}, {'test' => 123}]}
@@ -159,7 +159,7 @@ def add_logical_operator_expression(operator, op_expr)
159159
#
160160
# {'foo' => 'bar', '$or' => [{'hello' => 'world'}]}
161161
#
162-
# ... and operator is '$or' and op_expr is `{'test' => 123'}`,
162+
# ... and operator is '$or' and op_expr is +{'test' => 123'}+,
163163
# the resulting selector will be:
164164
#
165165
# {'foo' => 'bar', '$or' => [{'hello' => 'world'}, {'test' => 123}]}

lib/mongoid/deprecation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Deprecation < ::ActiveSupport::Deprecation
1414
# Overrides default ActiveSupport::Deprecation behavior
1515
# to use Mongoid's logger.
1616
#
17-
# @return Array<Proc> The deprecation behavior.
17+
# @return [ Array<Proc> ] The deprecation behavior.
1818
def behavior
1919
@behavior ||= Array(->(message, callstack, _deprecation_horizon, _gem_name) {
2020
logger = Mongoid.logger

lib/mongoid/document.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def becomes(klass)
185185
# Sets the internal state of this document. Used only by #becomes to
186186
# help initialize a retyped document.
187187
#
188-
# @params state [ Hash ] The map of internal state values.
188+
# @param [ Hash ] state The map of internal state values.
189189
#
190190
# @api private
191191
def internal_state=(state)
@@ -354,7 +354,7 @@ def update_discriminator(key_was)
354354

355355
# Marks all embedded documents with the given "new_record" state.
356356
#
357-
# @params new_record [ true | false ] whether or not the embedded records
357+
# @param [ true | false ] new_record whether or not the embedded records
358358
# should be flagged as new records or not.
359359
def mark_persisted_state_for_embedded_documents(new_record)
360360
embedded_relations.each_pair do |name, _meta|
@@ -369,7 +369,7 @@ def mark_persisted_state_for_embedded_documents(new_record)
369369

370370
# Either executes or enqueues the post-construction callbacks.
371371
#
372-
# @params execute_callbacks [ true | false ] whether the callbacks
372+
# @param [ true | false ] execute_callbacks whether the callbacks
373373
# should be executed (true) or enqueued (false)
374374
def resolve_post_construction_callbacks(execute_callbacks)
375375
if execute_callbacks
@@ -387,7 +387,7 @@ module ClassMethods
387387
# within the block. Callbacks may always be explicitly invoked by passing
388388
# `execute_callbacks: true` where available.
389389
#
390-
# @params execute_callbacks [ true | false ] Whether callbacks should be
390+
# @param [ true | false ] execute_callbacks Whether callbacks should be
391391
# suppressed or not.
392392
def with_callbacks(execute_callbacks)
393393
saved, Threaded.execute_callbacks =
@@ -406,8 +406,6 @@ def with_callbacks(execute_callbacks)
406406
# @param [ Hash ] attrs The hash of attributes to instantiate with.
407407
# @param [ Integer ] selected_fields The selected fields from the
408408
# criteria.
409-
# @param [ true | false ] execute_callbacks Flag specifies whether callbacks
410-
# should be run.
411409
#
412410
# @return [ Document ] A new document.
413411
def instantiate(attrs = nil, selected_fields = nil, &block)

0 commit comments

Comments
 (0)