docs: expand on operator documentaion
Include more specific details around logical operators.
doc: update link with proper syntax
doc: remove ambiguous language from operators doc
doc: remove link to source code file
doc: cleaning up some language, and removing some mistakes in understanding
doc: revert example to prior state
doc: fix spacing
doc: Update doc/syntax/operators.rdoc
align example with typical format
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
doc: Update doc/syntax/operators.rdoc
align format of other examples with rest of documentation
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Update doc/syntax/operators.rdoc
align format of other examples with rest of documentation
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
doc: include `and` & `or` operators
doc(operators): remove accute language
This allows for the following syntax:
```ruby
def foo(*)
bar(*)
end
def baz(**)
quux(**)
end
```
This is a natural addition after the introduction of anonymous
block forwarding. Anonymous rest and keyword rest arguments were
already supported in method parameters, this just allows them to
be used as arguments to other methods. The same advantages of
anonymous block forwarding apply to rest and keyword rest argument
forwarding.
This has some minor changes to #parameters output. Now, instead
of `[:rest], [:keyrest]`, you get `[:rest, :*], [:keyrest, :**]`.
These were already used for `...` forwarding, so I think it makes
it more consistent to include them in other cases. If we want to
use `[:rest], [:keyrest]` in both cases, that is also possible.
I don't think the previous behavior of `[:rest], [:keyrest]` in
the non-... case and `[:rest, :*], [:keyrest, :**]` in the ...
case makes sense, but if we did want that behavior, we'll have to
make more substantial changes, such as using a different ID in the
... forwarding case.
Implements [Feature #18351]
Makes link targets among percent literals.
Adds links to those targets.
Adds examples to percent literals.
Links from opening summary list to corresponding sections.
block to another method without having to provide a name for the
block parameter.
Implements [Feature #11256]
Co-authored-by: Yusuke Endoh mame@ruby-lang.org
Co-authored-by: Nobuyoshi Nakada nobu@ruby-lang.org
Magic comments like `frozen_string_literal` may appear everywhere
within the first comment section while `encoding` have to be the first
line, or second line after shebang.
Pin matching for local variables and constants is already supported,
and it is fairly simple to add support for these variable types.
Note that pin matching for method calls is still not supported
without wrapping in parentheses (pin expressions). I think that's
for the best as method calls are far more complex (arguments/blocks).
Implements [Feature #17724]
Remove discussion of Ruby 2.7 specific handling of keyword
argument separation. Add a small example of keyword to
positional hash conversion for methods not accepting
keyword arguments.
* typos, grammar, formatting
* use `concrete_method` again in `regular_method` example,
to better distinguish from `forwarding_method` example
* clarify that leading arguments before `...` require Ruby 3.0