Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CoolSnippets.md #347

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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