Skip to content

Commit

Permalink
Merge pull request #347 from pharo-open-documentation/olekscode-patch-1
Browse files Browse the repository at this point in the history
Update CoolSnippets.md
  • Loading branch information
jecisc authored Dec 17, 2023
2 parents e51bf82 + 054ed33 commit 908133c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions General/CoolSnippets.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ To get a specific icon, use `#iconNamed:` method as follow:
Smalltalk ui icons iconNamed: #arrowUp
```

## Rename programatically methods
## Rename methods programatically

In this section we'll present a snippet of code to rename all the methods of a class containing a substring to replace it by another substring.
In this section we will present a code snippet to rename all methods of a class by replacing one substring with another. First, we find all methods of a given class with names that contain a substring `A`, then we rename those methods to replace `A` with another substring `B`.

```Smalltalk
"Class in which we want to rename the methods"
Expand All @@ -123,7 +123,7 @@ class methods
permutation: permutationMap) execute ]
```

> Be careful, this will also rename the senders of those methods and if you have two methods of the same name in the image, it might badly rename some. Use this only on methods with unique names.
> Be careful, this will also rename the senders of those methods and if you have two methods with the same name in the image, it might badly rename some of them. Use this only on methods with unique names.
## Get all senders/implementors of a selector
The selector of a method is kind of the equivalent of the signature of a method or function in other programming languages.
Expand Down

0 comments on commit 908133c

Please sign in to comment.