aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/api_documentation_guidelines.textile
diff options
context:
space:
mode:
Diffstat (limited to 'guides/source/api_documentation_guidelines.textile')
-rw-r--r--guides/source/api_documentation_guidelines.textile33
1 files changed, 16 insertions, 17 deletions
diff --git a/guides/source/api_documentation_guidelines.textile b/guides/source/api_documentation_guidelines.textile
index 93120c15a7..14dddea4db 100644
--- a/guides/source/api_documentation_guidelines.textile
+++ b/guides/source/api_documentation_guidelines.textile
@@ -1,4 +1,4 @@
-h2. API Documentation Guidelines
+ h2. API Documentation Guidelines
This guide documents the Ruby on Rails API documentation guidelines.
@@ -6,7 +6,7 @@ endprologue.
h3. RDoc
-The Rails API documentation is generated with RDoc 2.5. Please consult the documentation for help with the "markup":http://rdoc.rubyforge.org/RDoc/Markup.html, and take into account also these "additional directives":http://rdoc.rubyforge.org/RDoc/Parser/Ruby.html.
+The Rails API documentation is generated with RDoc. Please consult the documentation for help with the "markup":http://rdoc.rubyforge.org/RDoc/Markup.html, and also take into account these "additional directives":http://rdoc.rubyforge.org/RDoc/Parser/Ruby.html.
h3. Wording
@@ -14,7 +14,7 @@ Write simple, declarative sentences. Brevity is a plus: get to the point.
Write in present tense: "Returns a hash that...", rather than "Returned a hash that..." or "Will return a hash that...".
-Start comments in upper case, follow regular punctuation rules:
+Start comments in upper case. Follow regular punctuation rules:
<ruby>
# Declares an attribute reader backed by an internally-named instance variable.
@@ -23,7 +23,7 @@ def attr_internal_reader(*attrs)
end
</ruby>
-Communicate to the reader the current way of doing things, both explicitly and implicitly. Use the recommended idioms in edge, reorder sections to emphasize favored approaches if needed, etc. The documentation should be a model for best practices and canonical, modern Rails usage.
+Communicate to the reader the current way of doing things, both explicitly and implicitly. Use the idioms recommended in edge. Reorder sections to emphasize favored approaches if needed, etc. The documentation should be a model for best practices and canonical, modern Rails usage.
Documentation has to be concise but comprehensive. Explore and document edge cases. What happens if a module is anonymous? What if a collection is empty? What if an argument is nil?
@@ -41,10 +41,9 @@ h3. Example Code
Choose meaningful examples that depict and cover the basics as well as interesting points or gotchas.
-Use two spaces to indent chunks of code--that is two spaces with respect to the left margin; the examples
-themselves should use "Rails coding conventions":contributing_to_ruby_on_rails.html#follow-the-coding-conventions.
+Use two spaces to indent chunks of code--that is, for markup purposes, two spaces with respect to the left margin. The examples themselves should use "Rails coding conventions":contributing_to_ruby_on_rails.html#follow-the-coding-conventions.
-Short docs do not need an explicit "Examples" label to introduce snippets, they just follow paragraphs:
+Short docs do not need an explicit "Examples" label to introduce snippets; they just follow paragraphs:
<ruby>
# Converts a collection of elements into a formatted string by calling
@@ -64,7 +63,7 @@ On the other hand, big chunks of structured documentation may have a separate "E
# Person.exists?(['name LIKE ?', "%#{query}%"])
</ruby>
-The result of expressions follow them and are introduced by "# => ", vertically aligned:
+The results of expressions follow them and are introduced by "# => ", vertically aligned:
<ruby>
# For checking if a fixnum is even or odd.
@@ -98,7 +97,7 @@ On the other hand, regular comments do not use an arrow:
h3. Filenames
-As a rule of thumb use filenames relative to the application root:
+As a rule of thumb, use filenames relative to the application root:
<plain>
config/routes.rb # YES
@@ -111,12 +110,12 @@ h3. Fonts
h4. Fixed-width Font
Use fixed-width fonts for:
-* constants, in particular class and module names
-* method names
-* literals like +nil+, +false+, +true+, +self+
-* symbols
-* method parameters
-* file names
+* Constants, in particular class and module names.
+* Method names.
+* Literals like +nil+, +false+, +true+, +self+.
+* Symbols.
+* Method parameters.
+* File names.
<ruby>
class Array
@@ -146,7 +145,7 @@ The description starts in upper case and ends with a full stop—it's standard E
h3. Dynamically Generated Methods
-Methods created with +(module|class)_eval(STRING)+ have a comment by their side with an instance of the generated code. That comment is 2 spaces apart from the template:
+Methods created with +(module|class)_eval(STRING)+ have a comment by their side with an instance of the generated code. That comment is 2 spaces away from the template:
<ruby>
for severity in Severity.constants
@@ -162,7 +161,7 @@ for severity in Severity.constants
end
</ruby>
-If the resulting lines are too wide, say 200 columns or more, we put the comment above the call:
+If the resulting lines are too wide, say 200 columns or more, put the comment above the call:
<ruby>
# def self.find_by_login_and_activated(*args)