20 Commits
Author SHA1 Message Date
Earlopain d66b37e3d8 Remove alternation pattern matching handling from the prism compiler
Since https://github.com/ruby/ruby/pull/15212 these are proper syntax
errors, so no need to handle this explicitly anymore.

Also updated the example in the docs for this
2025-11-17 10:11:40 -05:00
Joshua Young 99503ab975 Escape Binding reference in pattern matching docs 2025-03-21 10:36:13 +09:00
tomoya ishida 477c505ac0 [DOC] Fix output examples containing old Hash#inspect format
The inspect format was intentionally changed as an outcome of
[Bug #20433] [ruby-core:118668], but some documentation update
was missing, as [Bug #20962] pointed out. Update some output
examples that clearly use Hash#inspect.
2024-12-18 12:08:15 -05:00
Nobuyoshi Nakada b911d2222f [Bug #20482] [DOC] Clarify about pattern maching guard clause
Guard clauses can only be used in `case` pattern matching statements,
not in `=>`/`in` operators.
2024-05-12 16:23:00 +09:00
zverok ce0f3de032 [DOC] Update pattern matching docs for 3.2
* Remove section about experimental status
* Add references to core objects that can deconstruct
2023-02-19 22:32:52 +02:00
Kazuki Tsujimoto ecb6d6a4ef Allow omission of parentheses in one line pattern matching [Feature #16182] 2021-08-19 17:07:58 +09:00
Kazuki Tsujimoto eed5e8f796 One-line pattern matching is no longer experimental
https://github.com/ruby/dev-meeting-log/blob/master/DevelopersMeeting20210715Japan.md#feature-17724-make-the-pin-operator-support-instanceclassglobal-variables-jeremyevans0
2021-07-17 11:13:52 +09:00
Jeremy Evans fa87f72e1e Add pattern matching pin support for instance/class/global variables
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]
2021-07-15 09:56:02 -07:00
Kazuki Tsujimoto 21863470d9 Pattern matching pin operator against expression [Feature #17411]
This commit is based on the patch by @nobu.
2021-03-21 15:14:31 +09:00
Marcus Stollsteimer 9f9a389d95 doc/syntax/pattern_matching.rdoc: fix typos, grammar, style 2020-12-24 11:35:03 +01:00
Kazuki Tsujimoto b222a1a494 Fix a message in example code
Thanks to @zverok for the report.
2020-12-23 02:37:27 +09:00
Kazuki Tsujimoto 5c0abe2d94 Update documentation for pattern matching 2020-12-22 02:08:57 +09:00
Kazuki Tsujimoto 85ec6cc387 Fix markups and indentation 2020-12-20 13:35:20 +09:00
Kazuki Tsujimoto d37be18af5 Fix typos 2020-12-20 13:25:43 +09:00
Kazuki Tsujimoto 4902f96ee5 Update documentation for pattern matching 2020-12-20 13:22:53 +09:00
Kazuki Tsujimoto 88f3ce12d3 Reintroduce expr in pat [Feature #17371] 2020-12-13 11:51:49 +09:00
Kazuki Tsujimoto b601532411 Pattern matching is no longer experimental 2020-11-01 13:33:58 +09:00
Kazuki Tsujimoto cab9788e0c Fix typos 2020-04-05 12:15:18 +09:00
zverok 33260d404f Enhance pattern matching introduction 2020-04-04 23:16:49 +09:00
zverok 281b350058 Add pattern matching documentation
Add separate doc/syntax/pattern_matching.rdoc, add
link to control_expressions.rdoc.

The documentation is "reverse-engineered" from Ruby 2.7
behavior and early preview presentations, and corrected
by pattern-matching feature author @k-tsj.
2020-02-24 00:28:13 +09:00