mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Documentation improvements for Ruby core
* Top-level `return`; * Documentation for comments syntax; * `rescue` inside blocks; * Enhance `Object#to_enum` docs; * Make `chomp:` option more obvious for `String#each_line` and `#lines`; * Enhance `Proc#>>` and `#<<` docs; * Enhance `Processs` class docs.
This commit is contained in:
parent
cf9344131c
commit
bddb31bb37
Notes:
git
2019-10-26 14:58:35 +09:00
8 changed files with 118 additions and 25 deletions
|
@ -17,7 +17,14 @@ wish to limit the scope of rescued exceptions:
|
|||
# ...
|
||||
end
|
||||
|
||||
The same is true for a +class+ or +module+.
|
||||
The same is true for, +class+, +module+, and +block+:
|
||||
|
||||
[0, 1, 2].map do |i|
|
||||
10 / i
|
||||
rescue ZeroDivisionError
|
||||
nil
|
||||
end
|
||||
#=> [nil, 10, 5]
|
||||
|
||||
You can assign the exception to a local variable by using <tt>=>
|
||||
variable_name</tt> at the end of the +rescue+ line:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue