mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* doc/syntax/*.rdoc: separated modifier at sentence.
[ci skip][fix GH-1121] Patch by @clandry94 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b7d1536991
commit
4f94cb43fc
10 changed files with 50 additions and 53 deletions
|
|
@ -52,18 +52,18 @@ executed just like any other method. However, by convention, a method with an
|
|||
exclamation point or bang is considered dangerous. In ruby core library the
|
||||
dangerous method implies that when a method ends with a bang (<code>!</code>),
|
||||
it indicates that unlike its non-bang equivalent, permanently modifies its
|
||||
receiver. Almost always, Ruby core library will have a non-bang
|
||||
receiver. Almost always, ruby core library will have a non-bang
|
||||
counterpart (method name which does NOT end with <code>!</code>) of every bang
|
||||
method (method name which does end with <code>!</code>) that does not modify
|
||||
the receiver. This convention is typically true for ruby core library but
|
||||
may or may not hold true for other ruby libraries.
|
||||
|
||||
Methods that end with a question mark by convention return boolean. But they
|
||||
may not always return just +true+ or +false+. Often they will may return an
|
||||
Methods that end with a question mark by convention return boolean, but they
|
||||
may not always return just +true+ or +false+. Often, they will return an
|
||||
object to indicate a true value (or "truthy" value).
|
||||
|
||||
Methods that end with an equals sign indicate an assignment method. For
|
||||
assignment methods the return value is ignored, the arguments are returned
|
||||
assignment methods, the return value is ignored and the arguments are returned
|
||||
instead.
|
||||
|
||||
These are method names for the various ruby operators. Each of these
|
||||
|
|
@ -148,7 +148,7 @@ evaluated.
|
|||
end
|
||||
|
||||
Note that for assignment methods the return value will always be ignored.
|
||||
Instead the argument will be returned:
|
||||
Instead, the argument will be returned:
|
||||
|
||||
def a=(value)
|
||||
return 1 + value
|
||||
|
|
@ -450,7 +450,6 @@ May be written as:
|
|||
# handle exception
|
||||
end
|
||||
|
||||
If you wish to rescue an exception for only part of your method use +begin+ and
|
||||
If you wish to rescue an exception for only part of your method, use +begin+ and
|
||||
+end+. For more details see the page on {exception
|
||||
handling}[rdoc-ref:syntax/exceptions.rdoc].
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue