@@ -48,33 +48,30 @@ Structure
48
48
# @return [ Tiger ] The transmogrified result.
49
49
def transmogrify(person)
50
50
51
+ - **Errors:** Use ``@raise`` to explain errors specific to the method.
52
+
53
+ .. code-block:: ruby
54
+
55
+ # @raise [ Errors::Validations ] If validation failed.
56
+ def validate!
57
+
51
58
- **Private Methods:** Private methods should be documented unless they are
52
59
so brief and straightforward that it is obvious what they do. Note that,
53
60
for example, a method may be brief and straightforward but the type of
54
- its parameter may not be obvious, in which case the parameter needs to
55
- be appropriately documented.
61
+ its parameter may not be obvious, in which case the parameter must be
62
+ appropriately documented.
56
63
57
64
.. code-block:: ruby
58
65
59
66
private
60
67
61
68
# Documentation is optional here.
62
- def my_internal_method
63
-
64
- - **Notes:** Use the ``@note`` macro to explain caveats, edge cases,
65
- and behavior which may surprise users.
66
-
67
- .. code-block:: ruby
68
-
69
- # Clear all stored data.
70
- #
71
- # @note This operation deletes data in the database.
72
- def erase_data!
69
+ def do_something_obvious
73
70
74
71
- **API Private:** Classes and public methods which are not intended for
75
72
external usage should be marked ``@api private``. This macro does not
76
73
require a comment.
77
-
74
+
78
75
Note that, because Mongoid's modules are mixed into application classes,
79
76
``private`` visibility of a method does not necessarily indicate its
80
77
status as an API private method.
@@ -86,6 +83,18 @@ Structure
86
83
# @api private
87
84
def dont_call_me_from_outside
88
85
86
+ - **Notes and TODOs:** Use ``@note`` to explain caveats, edge cases,
87
+ and behavior which may surprise users. Use ``@todo`` to record
88
+ follow-ups and suggestions for future improvement.
89
+
90
+ .. code-block:: ruby
91
+
92
+ # Clear all stored data.
93
+ #
94
+ # @note This operation deletes data in the database.
95
+ # @todo Refactor this method for performance.
96
+ def erase_data!
97
+
89
98
- **Deprecation:** Use the ``@deprecated`` macro to indicate deprecated
90
99
functionality. This macro does not require a comment.
91
100
0 commit comments