Skip to content

Commit ae08a6a

Browse files
author
aless.hosry
committed
Update MatcherObject comment
1 parent d141554 commit ae08a6a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

MoTion/MatcherObject.class.st

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@ These two operators can express sub-patterns and the properties of the matched o
55
The following pattern matches an object of class `ClassA`, with a property `property1` having the value `aValue1`, and `property2` having `aValue2`:
66
```
77
ClassA % {
8-
#property1 <=> aValue1.
9-
#property2 <=> aValue2.
8+
#'property1' <=> aValue1.
9+
#'property2' <=> aValue2.
1010
}
1111
```
1212
The sub-patterns could also be more complex (Nested pattern). This mechanism contributes to the seamless addition of various properties, in a declarative way.
1313
14+
The percentage, combined with the SpaceShip operator, also allows to express Nested pattern where a first object is matched, then a second object in one of the properties of the first is matched. One may express a sub-pattern on this second object. For example, the following pattern matches an instance of `ClassA` with `aValue1` in its `property1`, and an instance of `ClassB` in its `property2`. This second object must have `aValue3` in its `property3`.
15+
16+
```
17+
ClassA % {
18+
#'property1' <=> aValue1.
19+
#'property2' <=> ClassB %% {
20+
#'property3' <=> aValue3.
21+
}
22+
}
23+
```
24+
1425
"
1526
Class {
1627
#name : 'MatcherObject',

0 commit comments

Comments
 (0)